[OpenLayers-Users] externalGraphic rendering problem

Brian May bmay at mapwise.com
Mon Jul 8 07:49:19 PDT 2013


Rob,

Try adding graphic: true to your properties in OpenLayers.Style, e.g.

new OpenLayers.Style({"graphic": true, "graphicWidth": 20, "graphicHeight": 20, "externalGraphic": "20x20_Multiport.png"})

Brian

7/8/2013 10:27 AM, Rob Gillan wrote:
> Hi,
>
> Long time GIS person but relatively new to OL (and rather amazed at how great it is).
>
> We have an application with an OSM base map, with approximately 25 vector layers (GeoJSON).  Delivered via Cordova on iOS/Android so displaying in a UIWebView.  There's no issue having points drawn by OL but when we try and use an externalGraphic all we see are little missing images, replaced by the dreaded question mark in a blue square.
>
> We have checked the image path and it points where it should be.  All the images are small 20x20 pngs which have RGB colour.  We tried using other default images instead (such as marker.png) with the same result, so it's not finding the image file or not rendering it for some reason.
>
> The layers have a StyleMap added, with the creation of the vector layer as:
>
> 						layerStyleMap = new OpenLayers.StyleMap({
> 							"default": new OpenLayers.Style({"graphicWidth": 20, "graphicHeight": 20, "externalGraphic": "20x20_Multiport.png"})
> 						});
> 						vector = new OpenLayers.Layer.Vector(layername, {styleMap: layerStyleMap, visibility: true});
> 						features = geoParser.read(geojson);
> 						vector.addFeatures(features);
> 						tm.olMap.addLayer(vector);
>
> Could anyone have an idea as to why these images wouldn't be found or rendered?  The images are in the same location as those for the controls/layerswitcher which are found ok.
>
> Thanks so much
> Rob
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>




More information about the Users mailing list