latitude-longitude

Minimum distance between a point and a line in latitude, longitude

老子叫甜甜 提交于 2019-11-28 23:54:26
问题 I have a line with two points in latitude and longitude A: 3.222895, 101.719751 B: 3.227511, 101.724318 and 1 point C: 3.224972, 101.722932 How can I calculate minimum distance between point C and a line consists of point A and B? It will be convenient if you can provide the calculation and objective-c code too. The distance is around 89 meters (using ruler in Google Earth). 回答1: Thanks to mimi and this great article http://www.movable-type.co.uk/scripts/latlong.html but they don't give the

Finding a set of coordinates within a certain range from latitude and longitide

╄→гoц情女王★ 提交于 2019-11-28 22:10:30
I am working on a project in javascript involving google maps. The goal is to figure out 16-20 coordinate points within n kilometers from a set of latitude longitude coordinates such that the 16 points if connected will form a circle around the original coordinates. The end goal is to make it so I can figure out coordinates to plot and connect on google maps to make a circle around a given set of coordinates. The code would go something like: var coordinates = Array(); function findCoordinates(lat, long, range) { } coordinates = findCoordinates(-20, 40, 3); Now to make the magic happen in the

Double or decimal for latitude/longitude values in C#

别说谁变了你拦得住时间么 提交于 2019-11-28 21:47:00
问题 What is the best data type to use when storing geopositional data in C#? I would use decimal for it's exactness, but operations on decimal floating point numbers are slower then binary floating point numbers (double). I read that most of the time you won't need any more then 6 or 7 digits of precision for latitude or longitude. Does the inexactness of doubles even matter then or can it be ignored? 回答1: Go for double , there are several reasons. Trigonometric functions are available only for

Moving lat/lon text columns into a 'point' type column

◇◆丶佛笑我妖孽 提交于 2019-11-28 21:15:06
问题 I've got a table in my MySQL database called house . Within the house table, there are a couple of text columns called latitude and longitude . I've added a new column called coords , of type point - http://dev.mysql.com/doc/refman/5.0/en/gis-class-point.html How would I move the latitude and longitude values into the new coords column? 回答1: Assuming you want a SPATIAL index on this column: ALTER TABLE mytable ADD coords Point; UPDATE mytable SET coords = Point(lon, lat); ALTER TABLE mytable

How to convert Vector Layer coordinates into Map Latitude and Longitude in Openlayers

旧城冷巷雨未停 提交于 2019-11-28 20:27:43
I'm pretty confused. I have a point: x= -12669114.702301 y= 5561132.6760608 That I got from drawing a square on a vector layer with the DrawFeature controller. The numbers seem...erm...awfull large, but they seem to work, because if I later draw a square with all the same points, it's in the same position, so I figure they have to be right. The problem is when I try to convert this point to latitude and longitude. I'm using: map.getLonLatFromPixel(pointToPixel(points[0])); Where points[0] is a geometry Point, and the pointToPixel function takes any point and turns it into a pixel (since the

How to sort array items by longitude latitude distance in javascripts?

廉价感情. 提交于 2019-11-28 19:02:14
I am having following JSON array of 6 locations. Is there any way sort these based on longitude and latitude where nearby locations come next in the array? [ {"id" : 279, "longitude":79.853239,"latitude":6.912283}, {"id" : 284, "longitude":79.865699,"latitude":6.885697}, {"id" : 13, "longitude":79.851187,"latitude":6.912220}, {"id" : 282, "longitude":79.858904,"latitude":6.871041}, {"id" : 281, "longitude":79.853346,"latitude":6.899757}, {"id" : 16, "longitude":79.854786,"latitude":6.894039} ] Sorting can be started from first item and result should be something like this [ {"id" : 279,

How to Sort Geo-points according to the distance from current location in Android

一世执手 提交于 2019-11-28 19:02:05
I have a "Place" object with a LatLng coordinate for each: import com.google.android.gms.maps.model.LatLng; public class Place{ public String name; public LatLng latlng; public Restaurant(String name, LatLng latlng) { this.name = name; this.latlng = latlng; } } and I have an ArrayList of these Places, something like this: ArrayList<Place> places = new ArrayList<Place>(); places.add("Place 1", LatLng(90.0,90.0)); places.add("Place 2", LatLng(93.0,93.0)); places.add("Place 3", LatLng(83.0,92.0)); places.add("Place 4", LatLng(93.0,91.0)); and I have "my" LatLng: LatLng myLocation = new LatLng(10

Is the Haversine Formula or the Vincenty's Formula better for calculating distance?

折月煮酒 提交于 2019-11-28 17:36:32
Which is better for calculating the distance between two latitude/longitude points, The Haversine Formula or The Vincenty's Formula? Why? The distance is obviously being calculated on Earth. Does WGS84 vs GCJ02 coordinates impact the calculation or distance (The Vincenty's formula takes the WGS84 axis into consideration)? For example, in Android, the Haversine Formula is used in Google Map Utils , but the Vincenty Formula is used by the android.Location object ( Location.distanceBetween() ). Haversine is a simpler computation but it does not provide the high accuracy Vincenty offers. Vincenty

Find closest longitude and latitude in array?

空扰寡人 提交于 2019-11-28 17:06:00
I have a longitude and latitude as a string in PHP like below 49.648881 -103.575312 And I want to take that and look in an array of values to find the closest one. The array looks like array( '0'=>array('item1','otheritem1details....','55.645645','-42.5323'), '1'=>array('item1','otheritem1details....','100.645645','-402.5323') ); I want to return the array that has the closest long and lad. In this case it would be the first one (and yes I know -400 is not a a possible value). Is there any quick and easy way to do this? I tried array searching but that didn't work. Difference code function

How to find latitude and longitude using C#

走远了吗. 提交于 2019-11-28 17:05:38
I have a WCF service in C#. In the Service call client sends a city name. I want to convert the city name to latitudes and longitudes and store in Database under demographics. I am planning to use Google API to implement above functionality. I have obtained an API key from Google and its of type 'Service account'. How can I obtain the latitude and longitude using which APIs? Do I need to install some SDK or any REST Service will do? If you want to use the Google Maps API have a look at their REST API, you don't need to install a Google Maps API just send a Request like http://maps.googleapis