latitude-longitude

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

北城以北 提交于 2019-11-30 02:21:56
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). Azam Thanks to mimi and this great article http://www.movable-type.co.uk/scripts/latlong.html but they don't give the whole picture. Here is a detail one. All this points are collected using Google Earth using Placemark to

Double or decimal for latitude/longitude values in C#

主宰稳场 提交于 2019-11-30 01:39:45
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? Go for double , there are several reasons. Trigonometric functions are available only for double Precision of double (range of 100 nanometers) is far beyond anything you'll ever require for Lat/Lon

Latitude/Longitude dataset for country borders [closed]

て烟熏妆下的殇ゞ 提交于 2019-11-29 23:32:38
I'm writing a program to display the expected lifetime of our product as it relates to average weather conditions in various locations across the globe and I'd like my map to reflect the latest country borders. Can anyone recommend somewhere to get a dataset of latitude/longitude points for the world's latest country borders? You can get the world country borders for free from Natural Earth: Natural Earth Layer Admin 0 contains the country borders I'm aware this question is three years old, but someone might find this useful: If a somewhat rough outline is acceptable, you may want to have a

Array contains latitude and longitude of a polygon in Google maps drawingManager

只谈情不闲聊 提交于 2019-11-29 23:22:41
问题 This is the most simplest way to add a drawing manager on the Google maps to draw polygon, circle, rectangle and etc by user. code: <html> <head> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&libraries=drawing"></script> <script> function initialize() { var map = new google.maps.Map(document.getElementById('map'), {zoom: 12, center: new google.maps.LatLng(32.344, 51.048)}); var drawingManager = new google.maps.drawing.DrawingManager(); drawingManager

Convert decimal latitude/longitude coordinates to iPad screen coordinates

落花浮王杯 提交于 2019-11-29 22:58:20
问题 I have a latitude/longitude decimal coordinates that I would like to convert to points that will fit within the area of the iPad coordinate system. My code takes in a latitude/longitude coordinates and converts them to cartesian coordinates (based on this question: convert to cartesian coordinates) The results of the conversion are (2494.269287, 575.376465). Here is my code (no compile or runtime errors): #define EARTH_RADIUS 6371 - (void)drawRect:(CGRect)rect { CGPoint latLong = {41.998035,

Detect if point in Latitude/Longitude based Polygon

微笑、不失礼 提交于 2019-11-29 21:46:45
问题 I'd like to detect, on the server side using C# only, whether a Latitude/Longitude based coordinate is within an area (polygon) made up of Latitude/Longitude based points. I believe the right way to do this is raycasting, but maybe there is already a C# implementation out there as it's not trivial? Also, I understand that SQL Server has some geometry function such as STIntersects but in order to use that I need both SQL Server 2008 running and every check would involve a database connection

Finding closest pair of points on a sphere

一曲冷凌霜 提交于 2019-11-29 21:03:39
问题 I know how to implement n log n closest pair of points algorithm (Shamos and Hoey) for 2D cases (x and y). However for a problem where latitude and longitude are given this approach cannot be used. The distance between two points is calculated using the haversine formula. I would like to know if there is some way to convert these latitudes and longitudes to their respective x and y coordinates and find the closest pair of points, or if there is another technique that can be used to do it. 回答1

Which data type for latitude and longitude?

ⅰ亾dé卋堺 提交于 2019-11-29 20:12:56
I am newbie to PostgreSQL and PostGIS. I want to store latitude and longitude values in PostgreSQL 9.1.1 database table. I will calculate distance between two points, find nearer points by using this location values. Which data type should I use for latitude and longitude? You can use the data type point - combines (x,y) which can be your lat / long. Occupies 16 bytes: 2 float8 numbers internally. Or make it two columns of type float (= float8 or double precision ). 8 bytes each. Or real (= float4 ) if additional precision is not needed. 4 bytes each. Or even numeric if you need absolute

convert latitude and longitude to northing and easting in java?

為{幸葍}努か 提交于 2019-11-29 19:36:23
问题 how to convert latitude and longitude to northing and easting in Java? 回答1: I'm assuming you mean UK OSGB easting and northings. The trigonometry behind this one is hilarious, but you can use the JCoord library for this, it makes it easy (if quite CPU intensive). To follow up on @DD's comments below, there is a gotcha with JCoord, in that you have to make sure you're using the correct datum when converting from Easting/Northing to Lat/Long, and vice versa. Take @DD's code: LatLng latLng = new

How to get the nearest area from a list of locations?

爷,独闯天下 提交于 2019-11-29 15:52:43
问题 I have a API which returns a list of different areas within a city with the weather at that area. I want to get the nearest area based on my current location. API returns Area Latitude Longitude Weather How to find the nearest area based on this data? 回答1: You would have to create CLLocation objects for all the areas, plus one for the current location of the user. Then use a loop similar to the one below to get the closest location: NSArray *allLocations; // this array contains all CLLocation