Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obtain Coordinates of Polygon Corners #56

Open
Vzzarr opened this issue Jul 3, 2017 · 0 comments
Open

Obtain Coordinates of Polygon Corners #56

Vzzarr opened this issue Jul 3, 2017 · 0 comments

Comments

@Vzzarr
Copy link

Vzzarr commented Jul 3, 2017

According to our project, we would like to know the coordinates of the polygon corners while the user is drawing it, in particular on click event on the map; so we would like to use this code of the library Leaflet JS or something similar:

L.ClickHandler = L.Handler.extend({
  addHooks: function() {
    L.DomEvent.on(document, 'click', this._captureClick, this);
  },
 
  removeHooks: function() {
    L.DomEvent.off(document, 'click', this._captureClick, this);
  },
  _captureClick: function(event) {
    latElong = mymap.mouseEventToLatLng(event)
  alert(mymap.mouseEventToLatLng(event))
  return latElong
  }
});
 
L.Map.addInitHook('addHandler', 'click', L.ClickHandler);
 
var mymap = L.map('mapid', {
  click: true
}).setView([51.505, -0.09], 13);

and obtaining a similar result:
image

Our question is: where could we insert this function in your project? Where and how is defined the map in your project?

Thank you for your attention
Best regards,
Nicholas

@Vzzarr Vzzarr changed the title Obtain Coordinates of Polygon corners Obtain Coordinates of Polygon Corners Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant