We can use latitude to convert coordinates into meters

I met Yelp Fusion API, which can find objects withing given radius around given location on Earth. Radius should be given in meters.

Simultaneously, Google Maps API uses degrees of latitude and longitude to report map bounds.

How to convert one to another so that provide meters to Yelp API? I realized, that this is pretty easy if we use latitude only:

EarthLatitude

Where alpha is latitude difference in radians.

To convert to degrees we should

2 * Pi / 360. *6371008.8 = 111195 meters per degree of latitude.

I wrote as simple JSFiddle here to illustrate this approach: https://jsfiddle.net/dimskraft/1boks8es/2/

Here is screenshot:

MetersPerDegree screenshot

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s