Get latitude / longitude distance in meters with QGIS

Introduction

Write how to get the value in meters in latitude and longitude of the layer's coordinate system. It is a value that I think will be a reference value. Please let me know if there is another good way.

environment

QGIS 3.4.4

Use Distans Area


layer = iface.activeLayer()
crs = layer.crs()
feature = layer.selectedFeatures()[0]
geom = feature.geometry()
print(geom.length())

area = QgsDistanceArea()
area.setEllipsoid(crs.ellipsoidAcronym())
print(area.measureLength(geom))

Code memorial service in 2.18


layer = iface.activeLayer()
crs = layer.crs()
feature = layer.selectedFeatures()[0]
geom = feature.geometry()

area = QgsDistanceArea()
area.setEllipsoid(crs.ellipsoidAcronym())
area.setEllipsoidalMode(True)
print area.measureLength(geom)

reference

QGIS Documentation: QgsDistanceArea stackexchange: QGIS Python Distance between points QgsDistanceArea.convertMeasurement not enough arguments error

Recommended Posts

Get latitude / longitude distance in meters with QGIS
Get nearby latitude / longitude points with Python's geoindex library
Get started with Python in Blender
Get additional data in LDAP with python
Visualize latitude / longitude coordinate information with kepler.gl
Get Started with TopCoder in Python (2020 Edition)
Get the address from latitude and longitude
Distance calculation between two latitude and longitude points with python (using spherical trigonometry)
[Python] Get the files in a folder with Python
Latitude / longitude coordinates ↔ UTM coordinate conversion with python
Collect store latitude / longitude information with scrapy + splash ②
Collect store latitude / longitude information with scrapy + splash ①
[Python] Get the numbers in the graph image with OCR
Get the result in dict format with Python psycopg2
Approximately 200 latitude and longitude data for hospitals in Tokyo
Continued) Try other distance functions with kmeans in Scikit-learn
YOLP: Extract latitude and longitude with Yahoo! Geocoder API.
Get in touch with functional programming in JavaScript or Python 3