Display issue with CartographicLineSymbol (thick white lines)

1120
4
04-27-2012 06:08 AM
YohanBienvenue
Occasional Contributor II
I'm trying to display some layers of a MapService as Feature Layers in my web application.

All the various symbols display fine (including SimpleLineSymbol and custom CharacterMarkerSymbol) but as you can see in the attached screenshot, CartographicLineSymbol and MarkerLineSymbol do not. Instead of displaying the thin blue lines it displays a thick white lines. I tried all browsers and they all behave the same. The lines display fine in ArcGIS Desktop, so I excluded the possibility of a wrong configuration in the mxd.

I tried to find information about the support of these in this API (i.e. for the web), or people encountering the same issue, but I haven't yet.

Thanks for any info/clues anyone can provide
0 Kudos
4 Replies
MarkLewin2
New Contributor
Hi Yohan,

By default the Feature Layer will use the same symbology as your map service. Are you trying to render these manually on the client yourself instead of using what is already defined in the layer?

Best regards,

Mark Lewin
0 Kudos
by Anonymous User
Not applicable
Original User: yohanb

Hi Mark,

No I'm not trying to draw anything myself on the browser side, I figured the ArcGIS for JavaScript API would detect and draw the correct symbols of the layers.
It does for some, but not for others, as you saw in the screenshot.

Here is some code, so far I just use these same options for all the layers (it's WIP):

var featureLayerOptions = {
   mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
   outFields: ["*"],
   infoTemplate: popUpTemplate()
};

var mapServiceURL = "http://" + g_ArcGISHost + g_ArcGISPort + "/arcgis/rest/services/" + g_ArcGISService + "/MapServer/6";   // 6 is for aqueduc right now

var featureLayer = new esri.layers.FeatureLayer(mapServiceURL, featureLayerOptions);

this.map.addLayer(featureLayer);


That's it really (except I have a loop since I have multiple layers), I expect the symbols to draw themselves correctly in the browser after that. Right?

If so, I'm hoping someone can confirm that they did manage to use this API to correctly display feature layers in their browser from a map service that make use of CartographicLineSymbol and MarkerLineSymbol. Then I'll know I'm doing something wrong, or I'm missing something.

One thing I know is that the mxd file was created in 9.3.1 and currently being served by ArcGIS Server 10.0. But since it displays fine in ArcGIS Explorer I don't think there's anything wrong with it.

Thanks

[ATTACH=CONFIG]13939[/ATTACH]
0 Kudos
YohanBienvenue
Occasional Contributor II
When I look at the SVG code in firebug, it looks like the paths are ok, but that the stroke-width, stroke-color and stroke-dasharray are not.
[ATTACH=CONFIG]14053[/ATTACH]


Compared to the layer made up of paths based on SimpleFillSymbol in the mxd, which are ok:
[ATTACH=CONFIG]14054[/ATTACH]


Note that in my first comment, I said SimpleLineSymbol was displaying ok, which is incorrect, I meant to say SimpleFillSymbol was displaying ok. All line symbols I tried, including SimpleLineSymbol, suffer from this issue.
0 Kudos
by Anonymous User
Not applicable
Original User: greenkarmic

The workaround for me right now is to replicate the symbology of the map service in the client side JavaScript (my webapp), and assign it to the feature layer.
I don't know why this works v.s. using the map service symbology, but it does.

Something like this:

var symbol = new esri.symbol.CartographicLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH,
                                                    new dojo.Color([0,92,230]),
                                                    1,
                                                    esri.symbol.CartographicLineSymbol.CAP_BUTT,
                                                    esri.symbol.CartographicLineSymbol.JOIN_MITER,
                                                    10);
   
this.featureLayer.setRenderer(new esri.renderer.SimpleRenderer(symbol));


I think it's a good enough workaround for me until this bug is fixed.
0 Kudos