Calculating new longitude, latitude from old + n meters

1628
5
Jump to solution
03-21-2019 09:43 AM
GlennErion
New Contributor

I have a known feature with latitude and longitude.

I have as second point defined by x and y offsets in meters from the known position. This second point is within a few KM of the known position.

I found algorithm - Calculating new longitude, latitude from old + n meters - Stack Overflow  to calculate the lat/long of the second point.

Is there a better way to do this in ArcGIS Javascript?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Glenn,

    absolutely. The JS API Point class has an offset method.

https://developers.arcgis.com/javascript/3/jsapi/point-amd.html#offset 

to convert between lat long and meters you can use webMercatorUtils geographictowebmercator method 

 esri/geometry/webMercatorUtils | API Reference | ArcGIS API for JavaScript 3.27 

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Glenn,

    absolutely. The JS API Point class has an offset method.

https://developers.arcgis.com/javascript/3/jsapi/point-amd.html#offset 

to convert between lat long and meters you can use webMercatorUtils geographictowebmercator method 

 esri/geometry/webMercatorUtils | API Reference | ArcGIS API for JavaScript 3.27 

View solution in original post

GlennErion
New Contributor

Where did this move to in 4.X?

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor
GlennErion
New Contributor

Awesome! Thanks!

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

0 Kudos