[OpenLayers-Users] how might i add features to a map

Dacres, Nehemiah [USA] Dacres_Nehemiah at bah.com
Mon Oct 29 13:12:44 PDT 2012


I wanted to create a map like this  http://openlayers.org/dev/examples/mobile-jq.html#mappage using JqueryMobile and OpenLayers but I wanted to add features using the click handler like in this example  http://openlayers.org/dev/examples/click.html but when  I activate my click handler to add features coded thusly

function createFeature(theName, theNote, theLocal){
    var observationLayer = map.getLayersByName("customFeatures")[0];//getLayersByName
    var point = new OpenLayers.Geometry.Point(theLocal.x,theLocal.y);
    var pointFeature = new OpenLayers.Feature.Vector(point);
    pointFeature.attributes={
        name: theName,
        point:theLocal,
        note:theNote
        };
    observationLayer.addFeatures([pointFeature]);
    // note, the marker icon for this point is declared in the styleMap of the customFeatures layer
}

What might I be doing wrong. How do I debug this?


Nehemiah I. Dacres
Consultant, Booz Allen Hamilton

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121029/9fa7fd77/attachment.html>


More information about the Users mailing list