# Tag Info

## Hot answers tagged coordinates

### 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 ...
• 1,062

### Measuring accuracy of latitude and longitude

I think this XKCD is a perfect answer to this question :) https://xkcd.com/2170/
• 1,113

### 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 ...
• 35.3k

### 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) ...
• 2,118
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....
• 77.8k
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,...
• 10.3k

### 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 ...
• 51.8k

### 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 ...
• 33.9k
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})'....
• 30.1k

### 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 ...
• 68.1k

### 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], [-...
• 646
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 ...
• 42.5k
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 ...
• 77.8k

### 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 ...
• 7,387

### 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 ...
• 812
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 ----------------------- ...
• 42.3k
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....
• 870
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/...
• 73.9k
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,...
• 830

### 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)...
• 1,277

### 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 ...
• 902

### 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;...
• 4,449
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.8k
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 ...
• 33.8k
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 ...
• 176

### 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.
• 446
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 ...
• 35.3k
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 ...
• 77.8k