[OpenLayers-Users] How can I *set* a point on the Input-Map via JS

Patrick Grochowy pgr1973 at gmx.de
Thu Apr 7 16:30:57 EDT 2011


Hi Folks,

I'm a little bit lost inside all the different js functions, 
drupal.behaviours, js-helper-functions
and so on of the OpenLayers-Module (6.x-2.0-alpha10) on Drupal 6. I 
have the module running, users
can set points to the map with their mouse, Drupal is saving the 
stuff and that part works quite
well (take a look at www.geomnesia.de - only in german at the moment).

Now I want to add the possibility, that users can set the point by 
typing/pasting in the latitude
and longitude by themselves. So I added (that's running on a local 
test-system it's not online now)
two fields to the form via jquery for the input and now want to add 
the point in the input-map
at that coordinates via js. But how can I do that, the docu 
(module-docu and also openlayers doco
or openlayers examples) says nothing about that.

For instance:

Drupal.openlayers.addFeatures("GEOMETRYCOLLECTION(POINT(" + 
lonIn.toFixed(12) + " " + latIn.toFixed(12) + "))" );

or

Drupal.behaviors.openlayers_behavior_drawfeatures("GEOMETRYCOLLECTION(POINT(" 
+ lonIn.toFixed(12) + " " + latIn.toFixed(12) + "))" ); (lonIn and 
latIn being the values, the user entered into the fields) inside my 
js does nothing.

Which function is called in OpenLayers or the Drupal.openlayers, when 
a user is clicking on the map
and setting the point? And how can I access this function, so that my 
OpenLayersInputMap thinks
the user has set the point and puts it on the position the user has entered?

Would be nice if someone could give a hint how to do that or has done 
something similiar and can
help me with this problem.

Regards Paddy



More information about the Users mailing list