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

pgr1973 pgr1973 at gmx.de
Fri Apr 8 18:22:58 EDT 2011


Unfortunately, nothing is happening. This is my code now:

| [...]
| var dsol = Drupal.settings.openlayers;
| var dsolmap = dsol.maps['openlayers-cck-widget-map-field_gp'];
| var dol = Drupal.openlayers;
| 
| var geometry = new OpenLayers.Geometry.fromWKT("POINT(" +
lonIn.toFixed(12) + " " + latIn.toFixed(12) + ")");
| var feature = new OpenLayers.Feature.Vector(geometry);
| dol.addFeatures(dsolmap, dsolmap.default_layer, [feature]); 

No error-message on the console (using Chrome), but also no
point on the input-map. Using your "vectorlayer" threw an 
error on the console, saying that "vectorlayer" is undefined.

Any other ideas?

Regards Paddy

Am 07.04.2011 22:58, schrieben Sie:
Try this

var geometry = OpenLayers.Geometry.fromWKT("POINT(2580000 5680000)");
var feature = new OpenLayers.Feature.Vector(geometry);

vectorlayer.addFeatures([feature]); 

Arnd

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Patrick
Grochowy
Gesendet: Donnerstag, 7. April 2011 22:31
An: users at openlayers.org
Betreff: [OpenLayers-Users] How can I *set* a point on the Input-Map via JS

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

_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-can-I-set-a-point-on-the-Input-Map-via-JS-tp6251457p6255476.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list