https://gis.stackexchange.com/a/2964/5599 Stack Exchange Network Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange [ ] Loading... 1. + Tour Start here for a quick overview of the site + Help Center Detailed answers to any questions you might have + Meta Discuss the workings and policies of this site + About Us Learn more about Stack Overflow the company, and our products. 2. 3. current community + Geographic Information Systems help chat + Geographic Information Systems Meta your communities Sign up or log in to customize your list. more stack exchange communities company blog 4. 5. Log in 6. Sign up Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up. Sign up to join this community [ano] Anybody can ask a question [ano] Anybody can answer [an] The best answers are voted up and rise to the top Geographic Information Systems 1. Home 2. 1. Public 2. Questions 3. Tags 4. Users 5. Unanswered 3. Teams Stack Overflow for Teams - Start collaborating and sharing organizational knowledge. [teams-illo-free-si] Create a free Team Why Teams? 4. Teams 5. Create free Team Teams Q&A for work Connect and share knowledge within a single location that is structured and easy to search. Learn more about Teams Algorithm for offsetting a latitude/longitude by some amount of meters Ask Question Asked 12 years, 10 months ago Modified 1 year, 1 month ago Viewed 257k times 159 I'm looking for an algorithm which when given a latitude and longitude pair and a vector translation in meters in Cartesian coordinates (x,y) would give me a new coordinate. Sort of like a reverse Haversine. I could also work with a distance and a heading transformation, but this would probably be slower and not as accurate. Ideally, the algorithm should be fast as I'm working on an embedded system. Accuracy is not critical, within 10 meters would be good. * coordinate-system * algorithm * spherical-geometry Share Improve this question Follow edited Jul 26, 2016 at 21:23 PolyGeo's user avatar PolyGeo 64.9k2929 gold badges107107 silver badges329329 bronze badges asked Oct 26, 2010 at 22:43 Thomas O's user avatar Thomas OThomas O 1,88333 gold badges1414 silver badges1111 bronze badges 2 * So you'd be fine modeling the earth as a sphere? - underdark Oct 26, 2010 at 22:54 * 1 Yeah, that would be fine as I'm expecting <1km offsets. - Thomas O Oct 26, 2010 at 22:58 Add a comment | 8 Answers 8 Sorted by: Reset to default [Highest score (default) ] 146 If your displacements aren't too great (less than a few kilometers) and you're not right at the poles, use the quick and dirty estimate that 111,111 meters (111.111 km) in the y direction is 1 degree (of latitude) and 111,111 * cos(latitude) meters in the x direction is 1 degree (of longitude). Share Improve this answer Follow edited Jul 30, 2015 at 19:47 answered Oct 27, 2010 at 3:48 whuber's user avatar whuberwhuber 69.1k1515 gold badges186186 silver badges281281 bronze badges 12 * 5 @Thomas: Actually, you can be very close to the poles. I checked against a UTM calculation using equal x- and y-displacements of 1400 m (so the total displacement is 2 km). The results are good to 8.6 meters or better. The worst latitude (for this direction and amount of displacement) is 81 degrees: the approximation actually gets more accurate as you move north and its error stays below 10 meters until you get beyond 89.6 degrees! - whuber Oct 27, 2010 at 21:36 * 78 Incidentally, these magic numbers of 111,111 are easy to remember by knowing some history: the French originally defined the meter so that 10^7 meters would be the distance along the Paris meridian from the equator to the north pole. Thus, 10^7 / 90 = 111,111.1 meters equals one degree of latitude to within the capabilities of French surveyors two centuries ago. - whuber Oct 27, 2010 at 21:38 * 5 So with the formula if I wanted to move +100m in the y direction from say 10.0 N, 10.0 E, would I just add 100 / 111111? If moving in the x direction +100m, would it be 100/(111,111x(cos 10))? Just making sure I've got this right. - Thomas O Oct 27, 2010 at 21:47 * 7 @Thomas Yes, that's right. Note how the second formula expands the apparent x-displacement (by virtue of dividing by a number less than 1) as it should, because a degree of longitude gets smaller as you move towards the poles from the equator. The only potential hitch is to make sure you and your software platform agree on what "cos" means: it had better interpret cos(10) as the cosine of 10 degrees, not 10 radians! (If not, 10 degrees = 10 * pi / 180 radians illustrates the simple conversion.) At this point, the code offered by @haakon_d should make complete sense to you. - whuber Oct 27, 2010 at 21:54 * 9 Somebody attempted to edit this answer to replace "meters" by "km." They probably were reading the comma "," in the European sense of a decimal point. I follow the American convention (which I believe is the convention of international publications, too) of using a comma to separate long digit strings into groups of three and a decimal point "." instead of the comma. (This usage is clearly shown in previous comments.) To avoid any ambiguity I have edited the answer to show clearly what the comma and point mean. - whuber Feb 11, 2013 at 16:20 | Show 7 more comments 84 As Liedman says in his answer Williams's aviation formulas are an invaluable source, and to keep the accuracy within 10 meters for displacements up to 1 km you'll probably need to use the more complex of these. But if you're willing to accept errors above 10m for points offset more than approx 200m you may use a simplified flat earth calculation. I think the errors still will be less than 50m for offsets up to 1km. //Position, decimal degrees lat = 51.0 lon = 0.0 //Earth's radius, sphere R=6378137 //offsets in meters dn = 100 de = 100 //Coordinate offsets in radians dLat = dn/R dLon = de/(R*Cos(Pi*lat/180)) //OffsetPosition, decimal degrees latO = lat + dLat * 180/Pi lonO = lon + dLon * 180/Pi This should return: latO = 51,00089832 lonO = 0,001427437 Share Improve this answer Follow edited Oct 27, 2010 at 14:02 answered Oct 27, 2010 at 13:55 haakon_d's user avatar haakon_dhaakon_d 1,39977 silver badges55 bronze badges 8 * 11 I just want to point out that this is identical to the answer I provided except you have replaced my value of 111,111 meters per degree by 111,319.5. Your value is slightly better at high latitudes but slightly worse in the lower latitudes (from 0 to about 40 degrees). Either value meets the stated requirements of accuracy. - whuber Oct 27, 2010 at 21:42 * 3 +1 for providing code. Note that it's more accurate than you suspect (the error is typically less than 5 m over 2000 m). - whuber Oct 27, 2010 at 21:55 * 1 I wondered if I should add a remark in my answer that this is an identical solution to yours except for the value of R, but left it out due to brevity. When it comes to precision you're right as long as you don't add any rotational errors to the system. Using offsets measured in a local projected coordinate system the rotational errors may grow quite large. - haakon_d Oct 28, 2010 at 8:33 * 1 That's an excellent point: we have implicitly assumed the x-displacement is at least close to true east-west and the y-displacement is close to north-south. If not, they have to be converted into equivalent E-W and N-S displacements (not just "eastings" and "northings") before computing their lat-lon equivalents. - whuber Nov 2, 2010 at 21:35 * The d distance parameter of the Aviation Formulary equations is in radians, e.g. (distance/radius-of-earth). - user1089933 Nov 15, 2012 at 21:10 | Show 3 more comments 27 I find that Aviation Formulary, here is great for these types of formulas and algorithms. For your problem, check out the "lat/long given radial and distance":here Note that this algorithm might be a bit too complex for your use, if you want to keep use of trigonometry functions low, etc. Share Improve this answer Follow edited Dec 28, 2017 at 23:27 kurtzmarc's user avatar kurtzmarc 11355 bronze badges answered Oct 27, 2010 at 7:41 Liedman's user avatar LiedmanLiedman 1,0531010 silver badges1313 bronze badges 1 * Thanks for this - looks ideal. Though I can't figure out if the distance is in meters or some other measurement. - Thomas O Oct 27, 2010 at 11:25 Add a comment | 4 I created a simple custom map on Google Maps that illustrates the estimation algorithm mentioned by the accepted answer (1/111111 == one meter). Feel free to see and play with it here: https://drive.google.com/open?id=1XWlZ8BM00PIZ4qk43DieoJjcXjK4z7xe& usp=sharing enter image description here To give more context - this map shows the coordinates 0,0 and then shows two more pins which are 1 meter north and 1 meter east of 0,0. Share Improve this answer Follow edited Jul 19, 2022 at 10:14 answered Sep 16, 2019 at 18:32 Janac Meena's user avatar Janac MeenaJanac Meena 14133 bronze badges Add a comment | 3 It might make sense to project the point first. You could make something like this pseudo-code: falt_coordinate = latlon_to_utm(original_koordinate) new_flat_coordinate = flat_coordinate + (x,y) result_coordinate = utm_to_latlon(new_flat_coordinate) where (x,y) is the desired offset. You don't need to use utm, any flat coordinate system, that makes sense in your area will do. What software are you working with? Share Improve this answer Follow answered Apr 24, 2018 at 17:59 Martin's user avatar MartinMartin 55244 silver badges1616 bronze badges 2 * 1 This would not work if you are at the edge of an UTM zone and if the move would make it cross to another UTM zone - Goldorak84 Jan 15, 2021 at 14:38 * wow how can convert the last point in degree distance relative to first point ? - Cristian Vargas Acevedo Jul 14, 2022 at 15:16 Add a comment | 3 Here is python code for whuber's answer from math import cos, radians def meters_to_lat_lon_displacement(m, origin_latitude): lat = m/111111 lon = m/(111111 * cos(radians(origin_latitude))) return lat, lon Here is R code deg2rad = function(deg) {(deg * pi) / (180)} meters_to_lat_lon_displacement = function(m, origin_latitude){ lat = m/111111 lon = m/(111111 * cos((deg2rad(origin_latitude)))) return(list(lat=lat,lon=lon)) } Share Improve this answer Follow edited Oct 1, 2021 at 14:15 answered Jan 27, 2021 at 21:44 Shawn's user avatar ShawnShawn 1,59699 silver badges2121 bronze badges 1 * wow how can convert the last point in degree distance relative to first point ? - Cristian Vargas Acevedo Jul 14, 2022 at 15:16 Add a comment | 0 Here is Swift version used on kodisha answer on SO: extension CLLocationCoordinate2D { func earthRadius() -> CLLocationDistance { let earthRadiusInMetersAtSeaLevel = 6378137.0 let earthRadiusInMetersAtPole = 6356752.314 let r1 = earthRadiusInMetersAtSeaLevel let r2 = earthRadiusInMetersAtPole let beta = latitude let earthRadiuseAtGivenLatitude = ( ( pow(pow(r1, 2) * cos(beta), 2) + pow(pow(r2, 2) * sin(beta), 2) ) / ( pow(r1 * cos(beta), 2) + pow(r2 * sin(beta), 2) ) ) .squareRoot() return earthRadiuseAtGivenLatitude } func locationByAdding( distance: CLLocationDistance, bearing: CLLocationDegrees ) -> CLLocationCoordinate2D { let latitude = self.latitude let longitude = self.longitude let earthRadiusInMeters = self.earthRadius() let brng = bearing.degreesToRadians var lat = latitude.degreesToRadians var lon = longitude.degreesToRadians lat = asin( sin(lat) * cos(distance / earthRadiusInMeters) + cos(lat) * sin(distance / earthRadiusInMeters) * cos(brng) ) lon += atan2( sin(brng) * sin(distance / earthRadiusInMeters) * cos(lat), cos(distance / earthRadiusInMeters) - sin(lat) * sin(lat) ) let newCoordinate = CLLocationCoordinate2D( latitude: lat.radiansToDegrees, longitude: lon.radiansToDegrees ) return newCoordinate } } extension FloatingPoint { var degreesToRadians: Self { self * .pi / 180 } var radiansToDegrees: Self { self * 180 / .pi } } Share Improve this answer Follow answered Jun 28, 2021 at 11:09 hbk's user avatar hbkhbk 10122 bronze badges 1 * wow how can convert the last point in degree distance relative to first point ? - Cristian Vargas Acevedo Jul 14, 2022 at 15:16 Add a comment | -3 Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. Vincenty's direct formula should do the job. Share Improve this answer Follow answered Jul 27, 2020 at 1:34 Gil's user avatar GilGil 1 1 * 4 Welcome to GIS SE! As a new user please take the tour. A good answer should be self-contained, and include all the steps and details required. Please edit your answer to add explanation as to how to use your suggestion, and why. - Midavalo Jul 27, 2020 at 1:54 Add a comment | Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity. Not the answer you're looking for? Browse other questions tagged * coordinate-system * algorithm * spherical-geometry or ask your own question. * The Overflow Blog * If you want to address tech debt, quantify it first * Fighting comment spam at Facebook scale (Ep. 602) * Featured on Meta * Moderation strike: Results of negotiations * Our Design Vision for Stack Overflow and the Stack Exchange network Linked 0 Calculate new Lat/Lon from initial Lat/Lon plus Cartesian X,Y 1 Increment GPS coordinates by a certain distance given in meters 0 Can you correct calculate the coordinates of a position given time and distance 12 Scale and Z factor have no effect on hillshade analysis in QGIS 10 Converting 1 meter to decimal degrees using FME 7 Method to generate points in any projection 5 Quick way to determine if facing a given lat/lon pair with a heading 6 How can I compute raster pixel width and height given raster bounds, row count, and column count? 7 PostGIS: Convert meters to arbitrary spatial reference units? 6 java vividsolutions jts wgs-84 distance to meters See more linked questions Related 5 Quick way to determine if facing a given lat/lon pair with a heading 59 Calculating Latitude/Longitude X miles from point? 2 Converting latitude longitude coordinate to x y coordinate 1 Translating latitude and longitude into "polar coordinates" around a point 3 Lat/Lon point transformation/offset on arbitrary segment 0 Longitude to metres ratio given a latitude for Google Maps Static API stitching? 1 Euclidean Coordinates to Lat Long Based on Reference Location in Python Hot Network Questions * Cannot duplicate Donut * Is "abreast a" something ever correct? * Why does my phone connect as a camera in Photos.app * Find a string in the middle * Can I use substitute modern wheels for my vintage bicycle? * What's the main difference between "You are not to use the elevator." and "You don't have to use the elevator"? * How can I replace circle objects with a sphere of same radius? * How many days did it take for the Terminator to find real Sarah Connor? * Do vampires gain exhaustion during a chase? * Why do methane engines require burn-off igniters? * Which small (1-gang) surface mount box is code compliant with NEMA 14-30R receptacle? * How to wrap a 2D shape and Knife Project toward a cylinder axis? * How to enjoy (or survive) a cruise if you don't like cruises? * Why is there a voltage difference between these two grounds? * Selecting diode with Vf~300mV at 100uA forward current for reproducing a zero crossing published TI circuit * Half even rounding * What type of security measure/contingent conditions could make jumping into a portal impossible inside a laboratory? * Does position commute with spin? * Why is this plane indicating an altitude of 117,200 feet? * What are Non-GNU versions of terminal commands? * Why did JavaScript choose to include a void operator? * Countering t-test "any feature is significant" results for large sample size datasets * Was there a German embassy open in 1941 Lisbon? * Given the parity of a function, how can I find the value of a parameter? more hot questions Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader. [https://gis.stackexc] * Geographic Information Systems * Tour * Help * Chat * Contact * Feedback Company * Stack Overflow * Teams * Advertising * Collectives * Talent * About * Press * Legal * Privacy Policy * Terms of Service * Cookie Settings * Cookie Policy Stack Exchange Network * Technology * Culture & recreation * Life & arts * Science * Professional * Business * API * Data * Blog * Facebook * Twitter * LinkedIn * Instagram Site design / logo (c) 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. rev 2023.8.24.43599 Your privacy By clicking "Accept all cookies", you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Accept all cookies Necessary cookies only Customize settings