I am trying to use a Drag Control in a web GIS. My problem begins when I finish the 'move' of a point. That is, originally the point has an XY like -8.308567019533697 and 41.376871762432685, displaying correctly in the map. After the move, the point has an XY like 49.01610355274739 and -293.0306348131995, displaying very far from the correct place.

My map:

var opcoes = {units: 'm', projection:
       extent_maximo,controls: []};

map = new OpenLayers.Map('map',opcoes);  

The layer of the drag control:

var localizador  = new OpenLayers.Layer.Vector("Localizador", {
        isBaseLayer: false,
        styleMap: new OpenLayers.StyleMap({
                'default': est_loc_def,
                "temporary": est_loc_temp
        displayInLayerSwitcher: false}); 
  • You are working in EPSG:3857, which is in meters. Those two points are only a few hundred meters apart. Are you sure this is what you mean? – John Powell Oct 1 '14 at 16:23
  • Yes. My point is play in the map moving the point inside a city. But when I move a few meters, the point goes to very far from the place where I click. – pdcc Oct 1 '14 at 16:27
  • You will need to produce a minimal working example for anyone to be able to debug, I think. – John Powell Oct 1 '14 at 16:28
  • You can see here: tests.proasolutions.pt Click in the 'streetView' symbol at the top of map and than click in the map. works fine.after that try drag feature and you will see the problem – pdcc Oct 1 '14 at 16:34
  • Forbidden page :-( – John Powell Oct 1 '14 at 21:50

The problem is that code:

'var coords = localizador.features[0].geometry.transform('EPSG:3857', 'EPSG:4326');'

I use that for StreetView and so I was changing the coords moving the point...

  • Great. I wondered if it was something like that, but that code wasn't in your question. – John Powell Oct 2 '14 at 9:55
  • Yes, my mistake but thank you for your help. – pdcc Oct 2 '14 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.