Questions tagged [latitude-longitude]

Managing data about geographic point locations, using a latitude-longitude pair (degrees north/south, and east/west, respectively) per point.

Latitude

enter image description here

Longitude

enter image description here

2920 questions
105
votes
11 answers

What's the best way to store co-ordinates (longitude/latitude, from Google Maps) in SQL Server?

I'm designing a table in SQL Server 2008 that will store a list of users and a Google Maps co-ordinate (longitude & latitude). Will I need two fields, or can it be done with 1? What's the best (or most common) data-type to use for storing this kind…
Jonathan
  • 32,202
  • 38
  • 137
  • 208
97
votes
10 answers

Algorithm to find all Latitude Longitude locations within a certain distance from a given Lat Lng location

Given a database of places with Latitude + Longitude locations, such as 40.8120390, -73.4889650, how would I find all locations within a given distance of a specific location? It doesn't seem very efficient to select all locations from the DB and…
Val Schuman
  • 1,798
  • 2
  • 18
  • 23
86
votes
6 answers

Java double vs BigDecimal for latitude/longitude

When storing latitudes/longitudes which are typically of the format: 44.087585 (i.e. max 2 numbers before the dot and 6dp) do I need to bother with bigdecimals?
DD.
  • 21,498
  • 52
  • 157
  • 246
84
votes
8 answers

Calculating distance between two geographic locations

please shed some light on this situation Right now i have two array having latitude and longitude of nearby places and also have the user location latiude and longiude now i want to calculate the distance between user location and nearby places and…
Sunny
  • 14,522
  • 15
  • 84
  • 129
80
votes
2 answers

Function to calculate geospatial distance between two points (lat,long) using R

I have geocoded points in long, lat format, and I want to calculate the distance between them using R. This seems pretty straight forward, yet I can't find a function that will do it easily. I've been attempting to do it with the gdistance…
SteveO7
  • 2,430
  • 3
  • 32
  • 40
79
votes
15 answers

proper/best type for storing latitude and longitude

In a system level programming language like C, C++ or D, what is the best type/encoding for storing latitude and longitude? The options I see are: IEEE-754 FP as degrees or radians degrees or radians stored as a fixed point value in an 32 or 64 bit…
BCS
  • 75,627
  • 68
  • 187
  • 294
77
votes
3 answers

Calculate distance in meters when you know longitude and latitude in java

Possible Duplicate: Working with latitude/longitude values in Java Duplicate: Working with latitude/longitude values in Java How do I calculate distance between two latitude longitude points? I need to calculate the distance between two points…
Espen Herseth Halvorsen
  • 6,175
  • 7
  • 36
  • 38
76
votes
12 answers

How can I measure distance and create a bounding box based on two latitude+longitude points in Java?

I am wanting to find the distance between two different points. This I know can be accomplished with the great circle distance. http://www.meridianworlddata.com/Distance-calculation.asp Once done, with a point and distance I would like to find the…
will
  • 1,175
  • 4
  • 17
  • 20
75
votes
18 answers

How to convert an address to a latitude/longitude?

How would I go about converting an address or city to a latitude/longitude? Are there commercial outfits I can "rent" this service from? This would be used in a commercial desktop application on a Windows PC with fulltime internet access.
swilc0x
  • 1,021
  • 1
  • 11
  • 7
66
votes
8 answers

How can I quickly estimate the distance between two (latitude, longitude) points?

I want to be able to get a estimate of the distance between two (latitude, longitude) points. I want to undershoot, as this will be for A* graph search and I want it to be fast. The points will be at most 800 km apart.
fread2281
  • 1,136
  • 1
  • 11
  • 31
65
votes
11 answers

Google Maps API - how to get latitude and longitude from Autocomplete without showing the map?

I'm trying to get latitude and longitude from Autocomplete Google Maps API without showing the map. In my script autocompletion works well, but I can't get the latitude and longitude.