latitude-longitude

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 int mapping of an integer range to the degree range: -> deg = (360/2^32)*val degrees, m...

How best to perform corridor range search over a set of latitude / longitude coordinates

Hi, What would be the best approach to finding the set of coordinates, from say about 5,00, which lie within a path of points, given a specified width. eg an aircraft following several waypoints. Is there a good way to also sort them in the same order as the route. Calculation speed would be more important than accuracy, since I'm l...

How can I do efficient range searching + counting with latitude/longitude data?

I'm working with a large set of points represented by latitude/longitude pairs (the points are not necessarily unique, there could be several points in the set that are at the same location). The points are stored in a database. What I need to do is figure out a way to efficiently perform a search to get the number of points that lie wi...

How do I convert coordinates to a Latitude & Longitude?

I am reverse engineering a transportation visualization app. I need to find out the latitude for the origin of their data feed. Specifically what XY 0,0 is. The only formulas I have found calculate distance between two points, or location of a bearing/distance. They use the XY to display a map in a very legacy application. The XY is in ...

Large dataset (SQL to C#), long load time fix

I have a site I'm building, it's an application that creates mail merges (more or less...) based on a couple of user preferences. It can generate Cartesian joins worth of data without a problem, but in comes the needs of enterprise to make life a bit more difficult... I have to build the application so that, after verifying zip codes ...

Convert a Cocoa Touch latitude/longitude to a string without degree symbol

I'm trying to convert CLLocation latitude / longitude to a string. I can successfully do this with the follow code: // extract latitude from CLLocation object and cast to string NSString *latitude = [[NSString alloc] initWithFormat:@"%g°", location.coordinate.latitude]; this gives me a value like: 34.10111º. I would like this number...

How to convert UTM coordinates to Latitude and Longitude?

Duplicates: How do I convert coordinates to a Latitude & Longitude? How to convert from UTM to LatLng in python or Javascript2 My current project is interfacing with a central geocoding service published by the local city planning department. The service is designed primarily for surveying, and as such returns coordinates in a UTM X...

Great Circle Distance question

I am familiar with the formula to calculate the Great Circle Distance between two points. i.e. <?php $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); $dist = acos($dist); $dist = rad2deg($dist); //convert degrees to distance depending on u...

Find all records in database that are within a certain distance of a set of lat and long points

I've seen all the examples and here's what I got so far. my table is simple: schools (table name) - School_ID - lat - long - county - extrainfo here's my code: <?php $con = mysql_connect("xxx","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } else {} mysql_select_db("xxx", $con); $lat...

Screen co ordinates to latitude and longitude

In open layers library, below is the method used to convert a screen co ordinate to latitude and longitude. I am not able to figure out the logic this method encapsulates? getLatLonFromPoint: function (point) { var center = this.getCenter(); //map center lat/lon var res = this.getResolution(); //pre defined by the u...

Tool or PHP code to convert IP address into lat/lng coordinates

I have thousands of IP addresses of visitors to my site, what tools can I use to convert these into lat/lng coordinates? I will then be able visualise the data on a map with filters for further demographics gathered. ...

GPS Location

I want to get my longitude and latitude on iphone in objective C. can any one guide me how to get these coordinates programmatically ...

Plotting a trajectory over time (a movie) using Google Earth/Maps

I have a set of points starting from (0,0,0) charting a path taken by a vehicle in 3D with each point being the distance traveled in its respective dimension. I need to do 2 things Let (0,0,0) denote a latitude and longitude. How do I convert my set of points in 3D to it's equivalent in latitude and longitude? Plot it frame-by-frame (w...

Parsing latitude and longitude with Ruby

Hi! I need to parse some user submitted strings containing latitudes and longitudes, under Ruby. The result should be given in a double Example: 08º 04' 49'' 09º 13' 12'' Result: 8.080278 9.22 I've looked to both Geokit and GeoRuby but haven't found a solution. Any hint? ...

Converting Longitude & Latitude to X Y on a map with Calibration points

If i have a jpeg map with size sizeX, sizeY and some calibration points on the map (X, Y, Lon, Lat) What would be the algorithm for calculating the corresponding XY point in the map with a given Longitude / Latitude pair? ...

Giving a lat/lon polyline thickness

This is more of an algorithms question, but hopefully someone can help me with this. I have a line made of of latitude/longitude points and I want to create a polygon from it with some predefined thickness. So basically the polygon would have edges that run parallel to the original polyline on either side. Any thoughts on the best approa...

MapView and GPS problem in iphone!

Hi guys, I have a MKMApView and given a region I would like to get it's boundries (in GPS values - I would like to get the GPS coordinates of the top left point, top right etc). The region is represented as a center with MKCoordinateSpan. Now I have already tried to convert the region to a rect, get its points and then convert each po...

Getting the pixel co-ordinates of a Google map marker

Is it possible to determine the pixel co-ordinates of a given marker, taking into account current zoom level and visible area of the map? ...

Distance between two locations using Latitude and Longitude way off what Google says.

I've spent a few days trying to figure this one out and can't seem to pinpoint the problems. I have a SQL 2005 database storing latitude and longitude as Decimal(18,8), all of which I received by querying Google. For these two locations: From: 10715 Downsville Pike Ste 100 MD 21740 to: 444 East College Ave Ste 120 State College PA, 168...

MySQL query for geographic midpoint

I need a MySQL query (or function) to calculate the geographic midpoint of an arbitrary number of latitude/longitude coordinates. I want to use Method C (Average latitude/longitude) as described on this page http://www.geomidpoint.com/calculation.html but can't figure out how to convert this into a SQL query. I'm looking for something of...