4

As a preface, I'm pretty new to the world of GIS. I'm working on a personal project to create interactive event timelines over custom maps. Being I'd like to be able to intake a an event location (in Latitude/Longitude values) and place it at the correct point on a map, I'd need to be sure I knew how to convert those Lat/Lon values to the appropriate cartesian coordinates over map image I'm using.

Right now, I'm working with a Gnomonic projection of Europe centered on 51N, 15E, with a edge angle of 15 degrees (admittedly not sure what edge angle means, precisely).

enter image description here

I was originally using the formula laid out here (http://mathworld.wolfram.com/GnomonicProjection.html) to try and convert between lat,lon and x,y - but I'm realizing I have no idea how to take the output X,Y value and transform it into something I can use for this specific map (being it doesn't take into account the center being on Europe, or particular "zoom")

So, to get to the point - do you have any suggestions for programs/libraries I can use to do this conversion for a subset of a map projection? Right now I'm pretty lost as to what steps I'd need to take to get form point A to B - so even an outline of how you might approach the problem would be super enlightening.

1

1 Answer 1

1

Conversion to Gnomonic (or any other) projection can be achieved using the pyproj.Proj class, which implements functionality similar to the Proj proj(1) command-line tool: https://pyproj4.github.io/pyproj/stable/api/proj.html

You can set the central longitude and latitude easily, but I don't think there's a way to set the edge angle. However you can set the ellipsoid used for the projection, and I think that should allow you to adjust the edge angle indirectly. However I don't know how to compute the needed ellipsoid from a desired edge angle. Hopefully someone who is more of an expert (I am a newbie myself) can come along to explain this part in more detail!

from pyproj import Proj

center_lon = 15.0
center_lat = 51.0
proj = Proj(proj="gnom", lon_0=center_lon, lat_0=center_lat)

You can then use the Proj.transform method to transform your data as needed: https://pyproj4.github.io/pyproj/stable/api/proj.html#pyproj.Proj.transform

If you are working with Shapely geometry objects, you can use shapely.ops.transform to transform the entire shape at once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.