ResymbolizeLayer
"{""id"": 3,""source"": {""type"": ""mapLayer"",""mapLayerId"": 3},""drawingInfo"": {""renderer"": {""type"": ""simple"",""symbol"": {""type"": ""esriSFS"",""style"": ""esriSFSSolid"",""color"": [0,255,0,0],""outline"": {""type"": ""esriSLS"",""style"": ""esriSLSSolid"",""color"": [0,0,255,255],""width"": 2}}}}}"
This is probably wrong. But from https://docs.geocortex.com/essentials/gvh/2.10/commands-help/#/commands/Visualization/ResymbolizeLayer I only get this help:
An object containing a gcxLayer parameter, which is either a Layer or a string giving the layer id and a renderer parameter, which is either an esri.renderer.Renderer object or the JSON string representation of one.
-
The parameter needs to be an object, so you should use the Newtonsoft library to serialize your text. 0 -
Hi Zack, Newtonsoft.Json.Linq.JObject.Parse("{'gcxLayer': {'mapService': 3, 'source':{'type':'mapLayer', 'mapLayerId': 3}},'renderer': {'type': 'simple', 'symbol': {'type': 'esriSFS','style': 'esriSFSSolid','color': [0,255,0,0],'outline': {'type': 'esriSLS','style': 'esriSLSSolid','color': [0,0,255,255],'width': 2}}}}")
I also tried 'gcxLayer': {'id': 3, 'mapService':3, 'type': 'FEATURE_LAYER'}, but no difference. If I leave the mapService part out of the JSON I get the error "TypeError: t.mapService is undefined".0 -
Thanks Luuk for asking the question two years ago. I also want to know how to use the command to save me create dozens of layers from the same data unnecessarily in map service for different categories. Could the Geocortex support team provide some clear answer? thank you 0 -
A bit late for the party, but here is how it works in case anyone is still using GVH.
The JSON passed to JObject.Parse() should contain two items:
- gcxLayer: This is the ID of the mapservice as a string
- renderer: A string representation of the renderer
This only seems to work with FeatureLayers and therefore, no layerId is necessary. The Id represents the Id of the mapservice that you can find in the designer. A FeatureLayer mapservice only contains a single layer in GVH.
Note that this doesn't mean you can't use a MapService, it's just that when you add it to the map, you should select a single layer and click "Add as FeatureLayer"
The renderer is in JSON format, but it's encoded as a string, so you must escape " and \ characters. Luuk's example uses single quotes, but that's not valid JSON.
{
"gcxLayer": "1",
"renderer": "{\"type\":\"simple\",\"symbol\":{\"type\":\"esriPMS\",\"url\":\"https://example.com/image.png\",\"width\":75,\"height\":75}}"
}The above example should be passes as a string to JObject.Parse(), so this means you need to escape again. To prevent going insane, I suggest to save the text as a file somewhere in the Sites directory, and use the Read File activity, with a filename like gcxfile:///MySite/MyFile.json
0
Please sign in to leave a comment.
Comments
4 comments