I have a point A
(EPSG 4326) in Berlin, Germany:
{
"type": "Point",
"coordinates": [
13.394994735717773,
52.514849775310154
]
}
I want to create point B
that is 500m to the east of point A
and point C
that is 500m to the north.
For this, I have to project point A
to a projection that preserves distance.
Can you recommend a projection that works for this operation in entire Germany?
I am working with GeoPandas and Shapely for this project.
Answer
You don't need an equidistant projection, but geodetic distances calculated on a spheroid (Vincenty's formulae) or a sphere (Great-cicle distance). For instance, geopy
is able to calculate them.
Here’s an example usage of Vincenty distance:
>>> from geopy.distance import vincenty
>>> newport_ri = (41.49008, -71.312796)
>>> cleveland_oh = (41.499498, -81.695391)
>>> print(vincenty(newport_ri, cleveland_oh).miles)
538.3904451566326Using great-circle distance:
>>> from geopy.distance import great_circle
>>> newport_ri = (41.49008, -71.312796)
>>> cleveland_oh = (41.499498, -81.695391)
>>> print(great_circle(newport_ri, cleveland_oh).miles)
537.1485284062816
Source: https://pypi.python.org/pypi/geopy#measuring-distance
how to find point B with the above-described method?
You need to solve the direct problem, i.e. given an initial point, its azimuth and a geodesic distance calculate the final point. A Python implementation of the direct problem is available in the PyGeodesy package.
Example:
>>> from pygeodesy.ellipsoidalVincenty import LatLon
>>> p = LatLon(-37.95103, 144.42487)
>>> d = p.destination(54972.271, 306.86816)
>>> print d.lon, d.lat
143.926497668 -37.6528177174
No comments:
Post a Comment