TransWikia.com

Large scale map projection (ca. 20 km) in pyproj results in wrong distance

Geographic Information Systems Asked by vanosten on November 8, 2020

I would like to transform from lon/lat (EPSG:4326) to a local x/y coordinate system for large scale equidistant maps with a map size of ca. 20 km. I need to do this mapping all over the globe apart from regions close to the poles.
Looking at https://projectionwizard.org/ it suggests for 1×1 degs something like +proj=cass +lon_0=-121.5 +datum=WGS84 +units=m +no_defs.

However, when looking at distances e.g. high up in Norway, the distances are way off. I must be doing something wrong, but I have no clue what it is.

self.trans_proj = pyproj.Transformer.from_crs(
  'EPSG:4326',
  {
    'proj': 'cass',  # tmerc
    'x_0': '500000.0',
    'lon_0': str(self._lon),
    'lat_0': str(self._lat),
    'k_0': '0.9999',
    'datum': 'WGS84'
  }
)

x, y, = self.trans_proj.transform(lon, lat, radians=False)

I set the lon_0 and lat_0 attributes to the current lon/lat of the centre of the map.

One Answer

Stupid me. Using always_xy=True as the third parameter in the .from_csr() method solved the problem.

Answered by vanosten on November 8, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP