-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from intersystems-community/indodesia_map
FEAT: new Indonesia map
- Loading branch information
Showing
12 changed files
with
392 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Class ID.Area Extends (%Persistent, %XML.Adaptor) | ||
{ | ||
|
||
/// Name of the Region | ||
Property Name As %String(MAXLEN = 500) [ Required ]; | ||
|
||
/// Guid for polygons in js file | ||
Property Guid As %String [ Required ]; | ||
|
||
/// Link to Wiki article | ||
Property DataUrl As %String(MAXLEN = 500); | ||
|
||
/// All values | ||
Relationship Parameters As ParameterValue [ Cardinality = many, Inverse = Region ]; | ||
|
||
Index GuidIdx On Guid [ IdKey, Unique ]; | ||
|
||
Storage Default | ||
{ | ||
<Data name="AreaDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Name</Value> | ||
</Value> | ||
<Value name="3"> | ||
<Value>DataUrl</Value> | ||
</Value> | ||
</Data> | ||
<DataLocation>^ID.AreaD</DataLocation> | ||
<DefaultData>AreaDefaultData</DefaultData> | ||
<IdLocation>^ID.AreaD</IdLocation> | ||
<IndexLocation>^ID.AreaI</IndexLocation> | ||
<StreamLocation>^ID.AreaS</StreamLocation> | ||
<Type>%Storage.Persistent</Type> | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/// | ||
Class ID.BI.IDCube Extends %DeepSee.CubeDefinition [ DependsOn = ID.Region, ProcedureBlock ] | ||
{ | ||
|
||
/// Cube definition from Architect. | ||
XData Cube [ XMLNamespace = "http://www.intersystems.com/deepsee" ] | ||
{ | ||
<cube xmlns="http://www.intersystems.com/deepsee" name="IDCube" displayName="IDCube" disabled="false" abstract="false" sourceClass="ID.Region" countMeasureName="%COUNT" bucketSize="8" bitmapChunkInMemory="false" precompute="0" disableListingGroups="false"> | ||
<dimension name="ParentRegion" disabled="false" hasAll="false" allCaption="All ParentRegion" allDisplayName="ParentRegion" type="data" hidden="false" showHierarchies="default"> | ||
<hierarchy name="H1" disabled="false" hidden="false"> | ||
<level name="Region" disabled="false" sourceProperty="ParentRegion" list="false" useDisplayValue="true" useAsFilter="true" hidden="false"> | ||
<property name="Population" disabled="false" sourceExpression="%cube.GetValue(%source.ParentRegion.Guid,1)" hidden="false" isName="false" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
<property name="Area" disabled="false" sourceExpression="%cube.GetValue(%source.ParentRegion.Guid,2)" hidden="false" isName="false" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
<property name="Name" disabled="false" sourceProperty="ParentRegion.Name" hidden="false" isName="true" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
</level> | ||
<level name="District" disabled="false" sourceProperty="Guid" list="false" useDisplayValue="true" useAsFilter="true" hidden="false"> | ||
<property name="Population" disabled="false" sourceExpression="%cube.GetValue(%source.Guid,1)" hidden="false" isName="false" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
<property name="Area" disabled="false" sourceExpression="%cube.GetValue(%source.Guid,2)" hidden="false" isName="false" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
<property name="Name" disabled="false" sourceProperty="Name" hidden="false" isName="true" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
</level> | ||
</hierarchy> | ||
</dimension> | ||
<listing name="New_listing1" disabled="false" listingType="table" fieldList="%ID,DataUrl,Name,ParentRegion->Guid,ParentRegion->Name"> | ||
</listing> | ||
</cube> | ||
} | ||
|
||
ClassMethod GetColor(min, max, value) As %String | ||
{ | ||
if ('value) return "rgb(0,0,0)" | ||
|
||
// Крайние границы: красный и зеленый, цвет для середины - желтый | ||
set middle = (max + min) / 2 | ||
|
||
if (value <= middle) | ||
{ | ||
set redPart = (value - min) / (middle - min) | ||
return "rgb(" _ (255 * redPart\1) _ ",255, 0)" | ||
} | ||
else | ||
{ | ||
set greenPart = (max - value) / (max - middle) | ||
return "rgb(255," _(255 * greenPart\1) _ ", 0)" | ||
} | ||
} | ||
|
||
ClassMethod GetValue(guid, type) As %Integer | ||
{ | ||
|
||
//b "L" | ||
//type=1 - population | ||
//type=2 - area | ||
// density | ||
s region=##class(ID.Region).%OpenId(guid) | ||
if $IsObject(region) { | ||
s parameter=##class(ID.ParameterValue).RegionParameterIndexOpen(region.Guid,type) | ||
if $IsObject(parameter) return parameter.Value} | ||
return "" | ||
} | ||
|
||
Parameter DOMAIN; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Class ID.Parameter Extends (%Persistent, %XML.Adaptor) | ||
{ | ||
|
||
Property Name As %String; | ||
|
||
Property UnitName As %String; | ||
|
||
Relationship Values As ParameterValue [ Cardinality = many, Inverse = Parameter ]; | ||
|
||
Storage Default | ||
{ | ||
<Data name="ParameterDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Name</Value> | ||
</Value> | ||
<Value name="3"> | ||
<Value>UnitName</Value> | ||
</Value> | ||
</Data> | ||
<DataLocation>^ID.ParameterD</DataLocation> | ||
<DefaultData>ParameterDefaultData</DefaultData> | ||
<IdLocation>^ID.ParameterD</IdLocation> | ||
<IndexLocation>^ID.ParameterI</IndexLocation> | ||
<StreamLocation>^ID.ParameterS</StreamLocation> | ||
<Type>%Storage.Persistent</Type> | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Class ID.ParameterValue Extends (%Persistent, %XML.Adaptor) | ||
{ | ||
|
||
Relationship Region As Area(XMLPROJECTION = "XELEMENT", XMLREFERENCE = "ID") [ Cardinality = one, Inverse = Parameters ]; | ||
|
||
/// State, county or city | ||
/// Parameter | ||
Relationship Parameter As Parameter(XMLPROJECTION = "XELEMENT", XMLREFERENCE = "ID") [ Cardinality = one, Inverse = Values ]; | ||
|
||
/// Value for region|county|city | ||
Property Value As %Float [ Required ]; | ||
|
||
Index PVIdx On (Region, Parameter); | ||
|
||
Index RegionParameterIndex On (Region, Parameter) [ Unique ]; | ||
|
||
Storage Default | ||
{ | ||
<Data name="ParameterValueDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Region</Value> | ||
</Value> | ||
<Value name="3"> | ||
<Value>Parameter</Value> | ||
</Value> | ||
<Value name="4"> | ||
<Value>Value</Value> | ||
</Value> | ||
</Data> | ||
<DataLocation>^ID.ParameterValueD</DataLocation> | ||
<DefaultData>ParameterValueDefaultData</DefaultData> | ||
<IdLocation>^ID.ParameterValueD</IdLocation> | ||
<IndexLocation>^ID.ParameterValueI</IndexLocation> | ||
<StreamLocation>^ID.ParameterValueS</StreamLocation> | ||
<Type>%Storage.Persistent</Type> | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Class ID.Region Extends Area | ||
{ | ||
|
||
/// Parent of region. For state=null, for county=state | ||
Relationship ParentRegion As Region(XMLPROJECTION = "XELEMENT", XMLREFERENCE = "ID") [ Cardinality = one, Inverse = ChildrenRegions ]; | ||
|
||
/// Region childrens. For state=counties, for county=0 | ||
Relationship ChildrenRegions As Region [ Cardinality = many, Inverse = ParentRegion ]; | ||
|
||
Index ParentRegionIdx On ParentRegion; | ||
|
||
Storage Default | ||
{ | ||
<Data name="RegionDefaultData"> | ||
<Subscript>"Region"</Subscript> | ||
<Value name="1"> | ||
<Value>ParentRegion</Value> | ||
</Value> | ||
</Data> | ||
<DefaultData>RegionDefaultData</DefaultData> | ||
<Type>%Storage.Persistent</Type> | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
Class ID.Utils | ||
{ | ||
|
||
ClassMethod Setup() | ||
{ | ||
do ..Populate() | ||
do ##class(%DeepSee.Utils).%BuildCube("IDCube",0) | ||
} | ||
|
||
ClassMethod Populate() As %Status | ||
{ | ||
do $CLASSMETHOD("ID.Area", "%KillExtent") | ||
do ..ImportXData("ID.Region", "RegionXData") | ||
do ..ImportXData("ID.Parameter", "ParameterXData") | ||
do ..ImportXData("ID.ParameterValue", "ParameterValueXData") | ||
quit $$$OK | ||
} | ||
|
||
ClassMethod ImportXData(className As %String, xDataName As %String) As %Status | ||
{ | ||
#dim sc As %Status = $$$OK | ||
set sc= $CLASSMETHOD(className, "%KillExtent") | ||
|
||
set itemsCount = 0 | ||
|
||
try{ | ||
|
||
if $$$ISERR(sc) | ||
{ | ||
write !, $System.Status.DisplayError(sc) | ||
$$$THROWONERROR(sc,sc) | ||
} | ||
|
||
#dim stream As %Stream.Object = ##class(%Dictionary.CompiledXData).%OpenId("ID.Utils"_"||"_xDataName).Data | ||
#dim reader As %XML.Reader = ##class(%XML.Reader).%New() | ||
|
||
set sc = reader.OpenStream(stream, "literal") | ||
$$$THROWONERROR(sc,sc) | ||
|
||
do reader.Correlate($piece(className, ".", 2), className) | ||
|
||
while reader.Next(.obj, .sc) | ||
{ | ||
if $$$ISERR(sc) | ||
{ | ||
write !, $System.Status.DisplayError(sc) | ||
$$$THROWONERROR(sc,sc) | ||
} | ||
|
||
set sc = obj.%Save() | ||
|
||
if $$$ISERR(sc) | ||
{ | ||
write !, $System.Status.DisplayError(sc) | ||
$$$THROWONERROR(sc,sc) | ||
} | ||
|
||
set obj = "" | ||
set itemsCount = itemsCount + 1 | ||
} | ||
} | ||
catch(ex){ | ||
w !, ex.Name_" "_ex.Location | ||
} | ||
|
||
write !,"Import - "_itemsCount_" objects of class "_className | ||
|
||
Quit $$$OK | ||
} | ||
|
||
XData RegionXData | ||
{ | ||
<RegionXData> | ||
<Region> | ||
<Name>North Sulawesi</Name> | ||
<Guid>1</Guid> | ||
<DataUrl>North Sulawesi</DataUrl> | ||
</Region> | ||
<Region> | ||
<Name>Gorontalo</Name> | ||
<Guid>1.1</Guid> | ||
<DataUrl>Gorontalo</DataUrl> | ||
<ParentRegion>1</ParentRegion> | ||
</Region> | ||
</RegionXData> | ||
} | ||
|
||
XData ParameterValueXData | ||
{ | ||
<ParameterValueXData> | ||
<ParameterValue> | ||
<Region>1</Region> | ||
<Parameter>1</Parameter> | ||
<Value>2621923</Value> | ||
</ParameterValue> | ||
<ParameterValue> | ||
<Region>1.1</Region> | ||
<Parameter>1</Parameter> | ||
<Value>1171681</Value> | ||
</ParameterValue> | ||
</ParameterValueXData> | ||
} | ||
|
||
XData ParameterXData | ||
{ | ||
<ParameterXData> | ||
<Parameter> | ||
<Name>Population</Name> | ||
</Parameter> | ||
<Parameter> | ||
<Name>Area</Name> | ||
<UnitName>sq km</UnitName> | ||
</Parameter> | ||
</ParameterXData> | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache"> | ||
<Document name="ID-Map of Indonesia.dashboard.DFI"> | ||
<dashboard xmlns="http://www.intersystems.com/deepsee/library" name="Map of Indonesia" folderName="ID" title="Map of Indonesia" description="" keywords="" owner="" shared="true" public="true" locked="false" resource="" timeCreated="2018-05-13T20:42:33.144Z" createdBy="_SYSTEM" category="" bookCover="" scheme="" worklistCount="2" snapTo="true" snapGrid="true" gridRows="10" gridCols="10" canResize="true" canModify="true" showTitleBar="true" titleBarOpacity="" titleBarColor="" selectedTitleBarOpacity="" selectedTitleBarColor="" titleBarTextColor="" selectedTitleBarTextColor="" titleBarFont="" companyName="" companyLogo="" companyStyle="" backgroundColor="white" backgroundImage="none" backgroundRepeat="no-repeat" backgroundSize="100% 100%" backgroundOpacity="1" widgetBorders="1px solid #F0F0F0" widgetBordersSwitch="edit" widgetBordersColor="#F0F0F0" widgetBordersStyle="solid" widgetBordersWidth="1" widgetBordersToggle="true"> | ||
<widget name="idpolygons" type="map" subtype="map" subtypeClass="" title="" dataSource="ID/Population Map.pivot" dataLink="" drillDownDataSource="" width="200" height="200" sidebarContent="" showSidebar="false" sidebarWidth="" maximized="false" homeRowL="0" homeColL="0" colSpanL="6" rowSpanL="8" showToolbar="true" showToolbarBottomBorder="true" showToolbarOnlyWhenMaximized="false" colorToolbar="#F0F0F0" opacityToolbar="1" backgroundColor="#F0F0F0" opacity="1" theme="" dataColorList=""> | ||
<control name="" action="applyFilter" target="Виджет2" targetProperty="[ParentRegion].[H1].[Region]" location="click" type="auto" controlClass="" label="District" title="" value="" text="" readOnly="false" valueList="" displayList="" activeWhen=""> | ||
<valueRequired>false</valueRequired> | ||
</control> | ||
<dataProperty name="colorProperty" label="colorProperty" width="" align="" subtype="" style="" display="value" format="" showAs="" valueColumn="false" summary="" summaryValue="" dataValue="ColorHSLValue" targetValue="" thresholdLower="" thresholdUpper="" rangeLower="" rangeUpper="" baseValue="" override=""></dataProperty> | ||
<dataProperty name="" label="" width="" align="" subtype="" style="" display="" format="" showAs="" valueColumn="false" summary="" summaryValue="" dataValue="Key" targetValue="" thresholdLower="" thresholdUpper="" rangeLower="" rangeUpper="" baseValue="" override=""></dataProperty> | ||
<property name="latitude">0.7893</property> | ||
<property name="longitude">113.9213</property> | ||
<property name="zoom">4</property> | ||
</widget> | ||
<widget name="Виджет2" type="pivot" subtype="pivot" subtypeClass="lineChart" title="" dataSource="ID/Population Map Mini Dist.pivot" dataLink="" drillDownDataSource="" width="200" height="200" sidebarContent="" showSidebar="false" sidebarWidth="" maximized="false" homeRowL="0" homeColL="6" colSpanL="4" rowSpanL="4" showToolbar="true" showToolbarBottomBorder="true" showToolbarOnlyWhenMaximized="false" colorToolbar="#F0F0F0" opacityToolbar="1" backgroundColor="#F0F0F0" opacity="1" theme="" dataColorList=""> | ||
</widget> | ||
<widget name="Виджет3" type="pivot" subtype="pieChart" subtypeClass="pieChart" title="" dataSource="" dataLink="Виджет2" drillDownDataSource="" width="200" height="200" sidebarContent="" showSidebar="false" sidebarWidth="" maximized="false" homeRowL="4" homeColL="6" colSpanL="4" rowSpanL="4" showToolbar="true" showToolbarBottomBorder="true" showToolbarOnlyWhenMaximized="false" colorToolbar="#F0F0F0" opacityToolbar="1" backgroundColor="#F0F0F0" opacity="1" theme="" dataColorList=""> | ||
</widget> | ||
</dashboard> | ||
</Document></Export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache"> | ||
<Document name="ID-Population Map Mini Dist.pivot.DFI"> | ||
<pivot xmlns="http://www.intersystems.com/deepsee/library" name="Population Map Mini Dist" folderName="ID" title="" description="" keywords="" owner="" shared="true" public="false" locked="false" resource="" timeCreated="2018-08-09T10:44:30.253Z" createdBy="_SYSTEM" category="" bookCover="" mdx="" cellWidth="120" columnHeaderStyle="" rowHeaderStyle="" cellStyle="" rowLabelSpan="true" columnLabelSpan="true" cellHeight="22" showEmptyRows="false" showEmptyColumns="false" cubeName="IDCUBE" caption="" listing="" listingRows="" showStatus="true" pageSize="100" colorScale="" rowTotals="false" columnTotals="false" rowTotalAgg="sum" columnTotalAgg="sum" rowTotalSource="page" showZebra="false" showRowCaption="true" printTitle="" printSubtitle="" printSubtitleOn="" showUser="" printPageSize="" printOrientation="1" printMarginTop="" printMarginLeft="" printMarginRight="" printMarginBottom="" printLabelWidth="" printCellWidth="" autoExecute="true" previewMode="false" manualMode="false" userMDX="" chartMarginTop="" chartMarginLeft="" chartMarginRight="" chartMarginBottom="" maxRows="" borderLeftCell="" borderRightCell="" borderTopCell="" borderBottomCell="" borderLeftCol="" borderRightCol="" borderTopCol="" borderBottomCol="" borderLeftRow="" borderRightRow="" borderTopRow="" borderBottomRow="" fontFamilyCell="" fontSizeCell="" fontFamilyCol="" fontSizeCol="" fontFamilyRow="" fontSizeRow="" showFilters="" showListingFilters="" showDate="" listingFontSize="" showZebraStripes="" filterTableStyle="" filterTableCaptionStyle="" filterTableItemStyle="" nowDisplayFormat="" measureLocation="columns" hideMeasures="1" backgroundImage="" backgroundOpacity=".12"> | ||
<rowAxisOptions spec="" key="" value="" text="" headEnabled="false" headCount="" filterEnabled="false" filterExpression="" orderEnabled="false" orderExpression="" orderDirection="BDESC" aggEnabled="false" aggFunction="" aggFunctionParm="" levelCaption="" levelFormat="" levelSummary="" levelType="" drillLevel="0" advanced="false" levelStyle="" levelHeaderStyle="" suppress8020="false" drilldownSpec="" enabled="true"> | ||
</rowAxisOptions> | ||
<columnAxisOptions spec="" key="" value="" text="" headEnabled="false" headCount="" filterEnabled="false" filterExpression="" orderEnabled="false" orderExpression="" orderDirection="BDESC" aggEnabled="false" aggFunction="" aggFunctionParm="" levelCaption="" levelFormat="" levelSummary="" levelType="" drillLevel="0" advanced="false" levelStyle="" levelHeaderStyle="" suppress8020="false" drilldownSpec="" enabled="true"> | ||
</columnAxisOptions> | ||
<rowLevel spec="[ParentRegion].[H1].[District].Members" key="" value="" text="District" headEnabled="false" headCount="" filterEnabled="false" filterExpression="" orderEnabled="false" orderExpression="" orderDirection="BDESC" aggEnabled="false" aggFunction="" aggFunctionParm="" levelCaption="" levelFormat="" levelSummary="" levelType="" drillLevel="0" advanced="false" levelStyle="" levelHeaderStyle="" suppress8020="false" drilldownSpec="" enabled="true"> | ||
</rowLevel> | ||
<columnLevel spec="[ParentRegion].[H1].[District].CurrentMember.Properties("Population")" key="" value="" text="Population" headEnabled="false" headCount="" filterEnabled="false" filterExpression="" orderEnabled="false" orderExpression="" orderDirection="BDESC" aggEnabled="false" aggFunction="" aggFunctionParm="" levelCaption="Population, pep." levelFormat="" levelSummary="" levelType="" drillLevel="0" advanced="false" levelStyle="" levelHeaderStyle="" suppress8020="false" drilldownSpec="" enabled="true"> | ||
</columnLevel> | ||
<sqlRestriction></sqlRestriction> | ||
</pivot> | ||
</Document></Export> |
Oops, something went wrong.