latitude-longitude

MySQL latitude and Longitude table setup

跟風遠走 提交于 2019-12-17 11:52:02
问题 I want to store latitude and longitude values of places in a mysql database table. With the future in mind I will want to be able to find these places within a certain radius of a specific location. Having said that, what datatypes should I store the latitude and longitude values in? Please could you provide me with a create table script for columns like so: place_id | lat | long Is there perhaps a column I am missing in the above table that will provide me with additional information that I

How do I check if a longitude/latitude point is within a range of coordinates?

最后都变了- 提交于 2019-12-17 11:31:51
问题 I have a number of longitude and latitude coordinates that make up a polygonal zone. I also have a longitude and latitude coordinate to define the position of a vehicle. How do I check that the vehicle is located within the polygonal zone? 回答1: This is essentially the Point in polygon problem on a sphere. You can modify the ray casting algorithm so that it uses arcs of great circles instead of line segments. for each pair of adjacent coordinates that make up your polygon, draw a great circle

How do I check if a longitude/latitude point is within a range of coordinates?

独自空忆成欢 提交于 2019-12-17 11:31:48
问题 I have a number of longitude and latitude coordinates that make up a polygonal zone. I also have a longitude and latitude coordinate to define the position of a vehicle. How do I check that the vehicle is located within the polygonal zone? 回答1: This is essentially the Point in polygon problem on a sphere. You can modify the ray casting algorithm so that it uses arcs of great circles instead of line segments. for each pair of adjacent coordinates that make up your polygon, draw a great circle

How do I check if a longitude/latitude point is within a range of coordinates?

↘锁芯ラ 提交于 2019-12-17 11:31:19
问题 I have a number of longitude and latitude coordinates that make up a polygonal zone. I also have a longitude and latitude coordinate to define the position of a vehicle. How do I check that the vehicle is located within the polygonal zone? 回答1: This is essentially the Point in polygon problem on a sphere. You can modify the ray casting algorithm so that it uses arcs of great circles instead of line segments. for each pair of adjacent coordinates that make up your polygon, draw a great circle

How does this Google Maps zoom level calculation work?

好久不见. 提交于 2019-12-17 10:59:37
问题 I know what the input and outputs are, but I'm just not sure how or why it works. This code is being used to, given a min and max longitude/latitude (a square) that contains a set of points, determine the maximum zoom level on Google Maps that will still display all of those points. The original author is gone, so I'm not sure what some of these numbers are even for (i.e. 6371 and 8). Consider it a puzzle =D int mapdisplay = 322; //min of height and width of element which contains the map

3D coordinates on a sphere to Latitude and Longitude

隐身守侯 提交于 2019-12-17 08:10:04
问题 I've got the following information: There exists a sphere with origin (0,0,0) and radius R. After doing a ray-sphere intersection I know a point (XYZ) in 3D space that is on the sphere (the exact position in 3D space where the line pierces the sphere hull). For my program I'd like to calculate the Latitude and Longitude of the XYZ point on the sphere, but I can't think (or Google) up a way to do this easily. So in short, the function that I'm trying to write is this: public static LatLon

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

99封情书 提交于 2019-12-17 08:02:02
问题 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 then go through them one by one, getting the distance from the starting location to see if they are within the specified distance. Is there a good way to narrow down the initially selected locations from the DB? Once I have (or don't?) a narrowed

Moving a CLLocation by x meters

☆樱花仙子☆ 提交于 2019-12-17 07:24:11
问题 I have a CLLocation defined, and I'd like to move that point x meters to the east and y meters to the south. How may I achieve that? 回答1: There is a C function that is close to what you are asking but it takes a bearing and distance. It's in my UtilitiesGeo class on github. You would pass the latitude and longitude from your CLLocation to it and then create a new CLLocation from the resulting lat2 and lon2 that it returns: /*--------------------------------------------------------------------

mySQL longitude and latitude query for other rows within x mile radius

不羁岁月 提交于 2019-12-17 07:05:33
问题 I have a database populated with roughly 10k rows currently. All of them have a longitude/latitude based on the center of a zipcode. I found a query that I am now attempting to expand on, but all in all it works well to a point. However, in my example below I am trying to find things within a 25 mile radius, which in all seems to work for the most part. Most of my results do yield within the 25 mile criteria, however I am getting a handful that are way off anything from 86 miles to 800 miles

Whats the fastest way to lookup big tables for points within radius MySQL (latitude longitude)

拥有回忆 提交于 2019-12-17 06:55:05
问题 Currently I have a few tables with 100k+ rows. I am trying to lookup the data like follows. SELECT *, SQRT(POW(69.1 * (latitude - '49.1044302'), 2) + POW(69.1 * ('-122.801094' - longitude) * COS(latitude / 57.3), 2)) AS distance FROM stops HAVING distance < 5 ORDER BY distance limit 100 But currently this method slows with high load. Some queries are taking 20+ seconds to complete. If anyone knows any better ways to optimize this would be great. 回答1: Well first of all if you have a lot of