ThinkGeo.com    |     Documentation    |     Premium Support

JSON attributes and displaying colors on MAP layers

Hi,

From the json below, i am trying to pull value of property - color_val and text_Val into map layer.

I am trying to accomplish two things one is print text_Val on map and color it depending on the value of color_val.
second thing is to display map coordinates and depending on the color_val property value change the vector color

Part 1:
{
“geometry”:{
“coordinates”:[
-66.0777,
18.4174
],
“type”:“Point”
},
“properties”:{
“text_Val”:“o”,
“color_val”:“1”
},
“type”:“Feature”
},
{
“geometry”:{
“coordinates”:[
-66.0777,
18.4174
],
“type”:“Point”
},
“properties”:{
“text_Val”:“Y”,
“color_val”:“1”
},
“type”:“Feature”
},

Code used to pull property is below

Dim valStyle As ValueStyle = Nothing
valStyle.ColumnName = “color_val”
valStyle.ValueItems.Add(New ValueItem(“1”, (TextStyles.CreateSimpleTextStyle(“text_Val”, “geographic”, 7,
DrawingFontStyles.Regular, New GeoColor(255, 0, 0)))))
shapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valStyle)

Part 2:
“geometry”:{
“coordinates”:[
[
[
-67.129402160644531,
18.569900512695312
],
[
-67.126701354980469,
18.569900512695312
],
[
-67.1239013671875,
18.569799423217773
]
]
],
“type”:“MultiLineString”
},

     "properties":{  
        "color_val":"1"
     },
     "type":"Feature"
  },

Can some one help on how to accomplish these two tasks thanks

Hi Sadana,

I think it’s the same question just like your other post JSON properties and ThinkGeo Map layers

We can solve the data source problem first.

You can convert your data into our Feature for example:

var f = new Feature(-66.0777, 18.4174);
f.ColumnValues.Add(“text_Val”,“0”);
f.ColumnValues.Add(“color_val”,“1”);

Then you can add the feature into our InmemoryFeatureLayer:

InmemoryFeatureLayer layer = new InmemoryFeatureLayer ();
layer Columns.Add(New FeatureSourceColumn(“text_Val”));
layer Columns.Add(New FeatureSourceColumn(“color_val”));
layer .InternalFeatures.Add(f);

Then you can set the style at the InmemoryFeatureLayer and render it just like your code rendered.

You should want to set MapUnit equal DecimalDegree.

Regards,

Ethan