Questions tagged [coordinates]

Refers to a sequence of numbers used to indicate the position of an object relative to an axis. Commonly, refers to a latitude/longitude pair that indicates a geographical position.

In geometry, a coordinate system is a system which uses one or more numbers, or coordinates, to uniquely determine the position of a point or other geometric element on a manifold such as Euclidean space. The order of the coordinates is significant and they are sometimes identified by their position in an ordered tuple and sometimes by a letter, as in "the x coordinate". The coordinates are taken to be real numbers in elementary mathematics, but may be complex numbers or elements of a more abstract system such as a commutative ring. The use of a coordinate system allows problems in geometry to be translated into problems about numbers and vice versa; this is the basis of analytic geometry.

A geographic coordinate system is a coordinate system that enables every location on the Earth to be specified by a set of numbers or letters. The coordinates are often chosen such that one of the numbers represents vertical position, and two or three of the numbers represent horizontal position. A common choice of coordinates is latitude, longitude and elevation.

6754 questions
271
votes
16 answers

Function to calculate distance between two coordinates

I'm currently using the function below and it doesn't work properly. According to Google Maps, the distance between these coordinates (from 59.3293371,13.4877472 to 59.3225525,13.4619422) are 2.2 kilometres while the function returns 1.6 kilometres.…
Airikr
  • 6,258
  • 15
  • 59
  • 110
216
votes
18 answers

Find nearest latitude/longitude with an SQL query

I have latitude and longitude and I want to pull the record from the database, which has nearest latitude and longitude by the distance, if that distance gets longer than specified one, then don't retrieve it. Table…
Basit
  • 16,316
  • 31
  • 93
  • 154
185
votes
13 answers

Measuring the distance between two coordinates in PHP

Hi I have the need to calculate the distance between two points having the lat and long. I would like to avoid any call to external API. I tried to implement the Haversine Formula in PHP: Here is the code: class CoordDistance { public $lat_a =…
maxdangelo
  • 3,063
  • 5
  • 21
  • 25
176
votes
3 answers

Plotting a list of (x, y) coordinates in matplotlib

I have a list of pairs (a, b) that I would like to plot with matplotlib in python as actual x-y coordinates. Currently, it is making two plots, where the index of the list gives the x-coordinate, and the first plot's y values are the as in the pairs…
CodeKingPlusPlus
  • 15,383
  • 51
  • 135
  • 216
155
votes
7 answers

How to position a DIV in a specific coordinates?

I want to position a DIV in a specific coordinates ? How can I do that using Javascript ?
Adham
  • 63,550
  • 98
  • 229
  • 344
154
votes
11 answers

Getting View's coordinates relative to the root layout

Can I get a View's x and y position relative to the root layout of my Activity in Android?
fhucho
  • 34,062
  • 40
  • 136
  • 186
110
votes
6 answers

Is OpenGL coordinate system left-handed or right-handed?

I am trying to understand the OpenGL coordinate system. However, some tutorials say the default coordinate system is left handed (see http://www.c-sharpcorner.com/UploadFile/jeradus/OpenGLBasics11172005014307AM/OpenGLBasics.aspx) and others say it…
341008
  • 9,862
  • 11
  • 52
  • 84
97
votes
5 answers

Create Google Maps links based on coordinates

How can I create Google Maps links based on coordinates. Their new basic share urls contain a lot of parameters, for example…
Staffan Estberg
  • 6,795
  • 16
  • 71
  • 107
85
votes
3 answers

Lat Long or Long Lat

There seems to be no standard whether Longitude,Latitude or Latitude,Longitude should be used. WSG84 and stuff based directly on it, seem to prefer Long,Lat. "Normal people" always tend to speak of Lat, Long - so I've very often seen code or…
Thomas M.
  • 1,496
  • 1
  • 10
  • 21
79
votes
13 answers

Calculate area of polygon given (x,y) coordinates

I have a set of points and would like to know if there is a function (for the sake of convenience and probably speed) that can calculate the area enclosed by a set of points. for example: x = np.arange(0,1,0.001) y = np.sqrt(1-x**2) points =…
pbreach
  • 16,049
  • 27
  • 82
  • 120
75
votes
14 answers

Covering Earth with Hexagonal Map Tiles

Many strategy games use hexagonal tiles. One of the main advantages is that the distance between the center of any tile and all its neighboring tiles is the same. I was wondering if anyone has any thoughts on marrying a hexagonal tile system with…
carrier
  • 32,209
  • 23
  • 76
  • 99
73
votes
5 answers

How to calculate an angle from points?

I want to get a simple solution to calculate the angle of a line (like a pointer of a clock). I have 2 points: cX, cY - the center of the line. eX, eY - the end of the line. The result is angle (0 <= a < 360). Which function is able to provide…
durumdara
  • 3,411
  • 4
  • 43
  • 71
71
votes
7 answers

How to validate latitude and longitude

I have two UITextFields which users can enter in a latitude and longitude, these co-ordinates are then used to create a pin on an MKMapView. I want find a way to validate whether the values they enter are actual GPS co-ordinates or just a load of…
user843337
68
votes
10 answers

Convert long/lat to pixel x/y on a given picture

I have a city map of Moscow. We modified a Google Maps image with some artistic elements, but the relation between GPS coordinates and pixels remains the same. Problem: How do I convert GPS coordinates from various data points we have into pixel…
Kalinin
  • 2,489
  • 8
  • 37
  • 49
54
votes
4 answers

How do you find a point at a given perpendicular distance from a line?

I have a line that I draw in a window and I let the user drag it around. So, my line is defined by two points: (x1,y1) and (x2,y2). But now I would like to draw "caps" at the end of my line, that is, short perpendicular lines at each of my end…
AZDean
  • 1,774
  • 2
  • 17
  • 24
1
2 3
99 100