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

Dacres, Nehemiah [USA] Dacres_Nehemiah at bah.com
Tue Oct 30 09:35:35 PDT 2012


Figured it out. theLocal is a LonLat parameter that has a lon , lat attribute, not an x y
These are map coordinates not graph ones

From: Dacres, Nehemiah [USA]
Sent: Monday, October 29, 2012 3:13 PM
To: 'openlayers-users at lists.osgeo.org'
Subject: how might i add features to a map

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/20121030/ed9a4566/attachment-0001.html>


More information about the Users mailing list