1

I have an OpenLayers map project where I currently add dynamic markers based on a query but I really want to show some text instead of the marker icon.

Is there a way I can either render some text to a PNG image and pass that to the marker object,or better still pass text to a marker for display instead of an icon?

Currently using this code to show a marker:

var size = new OpenLayers.Size(32,32);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon("./images/DrawingPin2.png",size,offset);
marker = new OpenLayers.Marker(lonlat,icon);
marker.setOpacity(1.0);
airportLayer.addMarker(marker);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.