89
votes
Measuring accuracy of latitude and longitude
POINT #1. lets differentiate Precision from Accuracy
As it is clear from the picture we can talk about Accuracy of a measurement (e.g. GPS measurement) if we already know the actual value (exact ...
69
votes
Measuring accuracy of latitude and longitude
I think this XKCD is a perfect answer to this question :)
https://xkcd.com/2170/
36
votes
Calculating latitude and longitude of points using QGIS
With QGIS 3 you can use two simple expressions doing all the reprojection in one go without having to care about settings or projections of the layer. To get decimal degrees as float values use:
For x ...
33
votes
Returning lat and long of centroid point with GeoPandas
Ran into this problem myself. If you want the x and y as separate GeoDataFrame columns, then this works nicely:
gdf["x"] = gdf.centroid.map(lambda p: p.x)
gdf["y"] = gdf.centroid.map(lambda p: p.y)
...
24
votes
Accepted
Shapely coordinate sequence to GeoDataFrame
Make a shapely polygon geometry from coordinate pairs.
Pass the polygon to GeoDataFrame constructor as a list.
import geopandas as gpd
from shapely.geometry import Polygon
coords = [(151....
21
votes
Accepted
Using Leaflet Js, is it possible to know the onclick location of a Marker (ignore anchor point)?
On one hand: whenever Leaflet handles a mouse (or touch) event, you can access the original DOM event in the originalEvent property of the event.
On the other hand: Given a mouse (or touch) DOM event,...
21
votes
Creating square buffers around points using shapely?
Here is how you can create square buffers using geopandas. Note that geometric operations in geopandas are performed by shapely.
import geopandas as gpd
from shapely.geometry import Point
import ...
20
votes
Creating point features with exact coordinates in QGIS
In QGIS 3, the NumericalDigitize tool no longer seems to be available but here is a further solution. As of QGIS 3 you can simply copy and past WKT directly into the canvas. This works for single or ...
19
votes
Accepted
Getting coordinates of point on mouse click using PyQGIS
You need QgsMapToolEmitPoint class to do that. Following code works well for that purpose:
from qgis.gui import QgsMapToolEmitPoint
def display_point( pointTool ):
print '({:.4f}, {:.4f})'....
19
votes
What does "¢" mean in a coordinate?
Your viewer, or the website, has some problem with the fonts. Perhaps your browser does not get access to the defined fonts. Works for me, though, and this is how it should look:
Coordinates are ...
17
votes
Rounding all coordinates in shapely
There are a few instances where @gene's answer does not work.
For example, the using the overprecise value -73.92391000000001
geojson = {'type': 'Polygon', 'coordinates': [[[-73.92391, 41.31064], [-...
17
votes
Accepted
Displaying vertex coordinates of polygon or line without creating new layer in QGIS
There is a way to display the coordinates... though not as a label.
One can add style with geometry generator to extract the vertices, then add a font marker style that will be overridden to display ...
17
votes
Accepted
What kind of coordinates are 38,40.1365N, 75,4.23933W?
Mobile devices use WGS84 coordinates, and the coordinates might be displayed in different formats. One of them is DDM format. A comma for separating degree and minute, a dot for decimal. Your ...
16
votes
Calculating latitude and longitude of points using QGIS
Since QGIS 3.8 (June 2019), there is now an algorithm to add the X and Y values called "Add X/Y fields to layer".
It can reproject coordinates on the fly.
If you still need a Degree Minute ...
16
votes
Seeking tool to place cursor to specific x,y coordinate
For QGIS 3.x and 2.x there is a plugin called Lat Lon Tools
https://plugins.qgis.org/plugins/latlontools/
It will let you enter coordinates in a variety of formats and pan to them at the current zoom ...
16
votes
Accepted
Getting correct WKT result to 4 decimal places using PostGIS
The simplest way to round geometry coordinates is to use ST_SnapToGrid:
SELECT ST_AsText(ST_SnapToGrid('POINT(-0.685239554498251 51.4940418030595)', 0.0001));
st_astext
-----------------------
...
16
votes
Accepted
Сreating polygon from coordinates in GeoPandas
This simple code is working for Python 3.9 and geopandas 0.9.0, and it works for older versions too.
Separate lists with latitude and longitude coordinates
import geopandas as gpd
from shapely....
16
votes
Accepted
Getting lat/long for centroids using QGIS
Inserting new fields with the field calculator and the expression $x and $y on the layer with your centroids should do the job. If you use the polygon layer of your lakes, you might include there lat/...
15
votes
Accepted
Flipping coordinates with Shapely
You can use a simple transformation function with shapely.ops' transform function.
For example:
def flip(x, y):
"""Flips the x and y coordinate values"""
return y,...
14
votes
List of central coordinates (centroid) for all countries?
You can retrieve this information using R like this:
library(rgeos)
library(rworldmap)
# get world map
wmap <- getMap(resolution="high")
# get centroids
centroids <- gCentroid(wmap, byid=TRUE)...
14
votes
Transforming single QgsGeometry object from one CRS to another using PyQGIS
Old Question, but duckduckgo brings you here for "pyqgis transform single geometry"
Just like Riccardo Pointed out, the accepted answer does not work for scripts in QGIS 3, the situation is explained ...
14
votes
Using Leaflet Js, is it possible to know the onclick location of a Marker (ignore anchor point)?
You always can retrieve the coordinates from the Leaflet object map. You can use something like this:
map.on('click', function(e){
var coord = e.latlng;
var lat = coord.lat;
var lng = coord.lng;...
14
votes
Accepted
Add an Excel file with a list of coordinates to QGIS as a layer?
You can often make a WKT (Well Known Text) column in Excel without too much fiddling, which effectively creates a spatial definition for points, lines or polygons within a single field.
What you want ...
14
votes
Accepted
Copying coordinates under mouse to clipboard in QGIS
For QGIS versions QGIS 3.14 and higher
Nowadays the functionality of this Plugin has been added as a map toolkit in QGIS 3.14, see this issue on the GitHub for more details.
So, simply right-mouse ...
13
votes
Accepted
Extracting points from LineString or Polygon and making dictionary out of them in GeoPandas
I had the same question, here we can use a lambda function:
import geopandas as gpd
gdf = gpd.read_file('some_lines.shp')
Say your GeoDataFrame looks like this:
id xs_ID Orientatio ...
13
votes
Adding x,y coordinates to Attribute table in QGIS
Use a built-in tool "Add X/Y fields to layer"
There you can choose a coordinate system in which you want your coordinates and add an optional field prefix.
13
votes
Accepted
Finding northernmost/southernmost [...] point of polygon using QGIS
Open the fieldcalculator and use these expressions:
x_min($geometry), x_max($geometry), y_min($geometry), y_max($geometry)
To get the entire point geometry, not just x or y value, you can get all ...
13
votes
Accepted
Mean coordinates in QGIS yields displaced point from centroid
Can this be due to having a different CRS for the grid from the project one?
I don't think so. This is more likely caused by that the polygon starts and ends in the lower left corner. (that means ...
12
votes
Measuring accuracy of latitude and longitude
The other excellent answers here are primarily about latitude. A degree of longitude shrinks from about 111 km at the equator to 0 at the poles, so the nominal precision of a decimal degree of ...
12
votes
Converting csv to kml/geojson using ogr2ogr or equivalent command line tools?
Starting with GDAL 2.1, it is possible to directly specify the
potential names of the columns that can contain X/longitude and
Y/latitude with the X_POSSIBLE_NAMES and Y_POSSIBLE_NAMES open option....
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
coordinates × 1700qgis × 459
coordinate-system × 433
arcgis-desktop × 146
python × 134
latitude-longitude × 126
point × 104
r × 83
polygon × 80
convert × 76
gps × 72
shapefile × 62
csv × 60
arcmap × 59
xy × 56
raster × 53
distance × 53
openlayers × 37
postgis × 36
javascript × 36
pyqgis × 34
utm × 34
grids-graticules × 34
geometry × 33
google-maps × 32