[OpenLayers-Users] externalGraphic rendering problem

Rob Gillan rob at mosais.com
Mon Jul 8 07:27:10 PDT 2013


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


More information about the Users mailing list