I'm looking for some hints (Javascript custom function or openlayers 4 function) ...) that can help me to convert a wms response URL parameters to get my click coordinates.

Here an example of url to convert to a click coordinate.


My goal is to recreate a gml from this query based on derived wkt Point.


Your click coordinates are 722,403 px on a window that is 1155x674px with a real world bounding box of -7859605.72457123640924692, 5954835.61684618983417749, -7802662.21180228982120752, 5988064.99139707256108522.

So simple maths gives you

x = (-7802662.2118022898212 - -7859605.72457123640924692) * 722/1155
y = (5988064.99139707256108522 - 5954835.61684618983417749) * 403/674

converting to javascript is left as an exercise for the reader.

But if it was me I'd remember the event coordinates I used to construct the URL in the first place.

  • But how to manage the correct projection as with local projection (utm?) how the coordinates increases? – PEL Sep 19 '17 at 15:13
  • that doesn't matter – Ian Turton Sep 19 '17 at 15:22
  • This calculation, can you tell me a little? – Ömür Bilgili Sep 21 '17 at 15:15

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.