[OpenLayers-Users] adding points on the given coordinates
Christopher Schmidt
crschmidt at metacarta.com
Fri Apr 17 07:38:22 EDT 2009
On Fri, Apr 17, 2009 at 10:08:52AM +0200, wrap map wrote:
> Senario, i have a lon-lat value and i want to draw a point on that value, i
> had tried the following code to draw point;
>
> function createPoint() {
> //create your point with your values
> newpoint = new OpenLayers.DFeature.Vector(
> new OpenLayers.Geometry.Point(
> (document.getElementById('longval').value,
> document.getElementById('latval').value)
> )
> );
> //add point to layer
> vector.addFeatures(features);
> }
>
>
>
> the error is "features", what is the error and how can i solve this problem.
Four problems:
* "OpenLayers.DFeature" doesn't exist, but that's probably a
transcription typo.
* It is possible (not sure about likely) that you iwll have problems
passing strings instead of floats: call parseFloa taround the
gEBI calls.
* You put your points in additional parens, but this isn't the right
thing to do. (I'm not een sure how it would work.) remove the
internal ()
* 'features' doesn't exist; instead, you just want to
vector.addFeatures(newpoint);
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list