Layer Symbology from REST endpoint as JSON

3979
1
09-23-2013 01:12 PM
CurtWalker
New Contributor
I'm about 2/3 of the way to a complete solution to this problem.  Hopefully someone can help me with the last 1/3.

I know symbol legends are not provided in REST, at least not in any turn-key form like a complete legend image that you just reference with a URL.  But there does appear to be JSON for each layer in a Map Service including renderer information.  For points it was easy, I just referenced the symbol URL for each layer in the map service and injected them into my layer list.  Polygons were not as easy since there's no ready-made URL for the symbol (that I could find).  So what I did was reference the outline and fill properties in the JSON for my polygon layers, then use HTML 5 canvas to build a little symbol patch dynamically.

That leaves the polylines, and that's where I'm stumped.  I've got a layer with the polyline that consists of a black middle line surrounded by 2 pixels of yellow on either side.  Nowhere in the JSON does is split out the symbol into separate components.  In fact, the JSON for this layer makes it look as if it's just a simple black line.

Does anyone know where I might be able to reference the missing information for a polyline in REST that is more complicated than just a single solid color?
0 Kudos
1 Reply
AdamJoseph1
New Contributor

if you serve out the GeoJSON with cartoview you should be able to inject your REST for defining symbology or anything you want

0 Kudos