Patrick
Patrick

Reputation: 2781

Manipulate Lat/Lng Coordinates for google maps

I need to present markers on a Google map based on map bounds, and to calculate distance between markers.
What is the best option to manipulate lat/lng coordinates from SQL-server to a Google map, spatial or lat/lng compare?
It seems that MVC ef5 spatial are more then I need, but that lat/lng compare are not correct because earth is not flat.

EDIT: Example1:

x1,y1--------------x2,y2
  |                  |
  |                  |
  |                  |
x3,y3--------------x4,y4

I need to store and find all addresses that are in the lat/lng visible google map area based on the map visible area bounds.

Example2:

I need to list all addresses in the radius of X kilometers of a marker.

Upvotes: 3

Views: 908

Answers (2)

Jorge
Jorge

Reputation: 18237

To store the lat and long if you're using sql server 2008 R2 exits a special datatype for geometrys I would like to recommend that read this article Spacial DataType

To calculate the distance between two points you have here two opctios

Implement's the caculation of Levenshtein distance specially design for this

Or you can make the calculation for the client side of your application using the Geometry Library of google maps api which contains the method. And receive two lat/lng

google.maps.geometry.spherical.computeDistanceBetween();

Upvotes: 1

TheEvilPenguin
TheEvilPenguin

Reputation: 5682

To calculate the distance between two pairs of lat/long projected coordainates you want Vincenty's formulae

Upvotes: 2

Related Questions