Python – How to Transform Geospatial Data from Decimal Degrees to X,Y Coordinates Using Pyproj

coordinate systempyprojpythonpython 3

I have the following dataframe

 latitude  longitude             xx            yy
0  37.75153 -122.39447  553343.041098  4.178420e+06
1  37.75149 -122.39447  553343.069815  4.178415e+06
2  37.75149 -122.39447  553343.069815  4.178415e+06
3  37.75149 -122.39446  553343.950755  4.178415e+06
4  37.75144 -122.39449  553341.343829  4.178410e+06

where latitude and longitude are in decimal degrees

I am using this code to go from latitude & longitude to xx & yy.

from pyproj import Proj
pp = Proj(proj='utm', zone=10, ellps='WGS84', preserve_units=False)
xx, yy = pp(dt["longitude"].values, dt["latitude"].values)

The documentation of pyproj mentions:

"Calling a Proj class instance with the arguments lon, lat will
convert lon/lat (in degrees) to x/y native map projection coordinates
(in meters)"

1) A very amateur question that I have is: Are the degrees that are
mentioned in the documentation, the same as the decimal degrees ?
If not, how can I go from one to another ?

2) Secondly I dont understand what these parameters of the function
stand for

   proj='utm', zone=10, ellps='WGS84'

Any shred of light ?

Best Answer

For #1, yes, they are the same.

For #2, the UTM projection is a system of zones setup for the Transverse Mercator projection. See: https://en.m.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system

The string you are using to define the UTM projection is a PROJ string an each parameter is defined here: https://proj.org/operations/projections/utm.html

proj=utm - tells PROJ that you are using the UTM projection

zone=10 - says to use zone 10 for the UTM projection

ellps=WGS84 - defines the ellipsoid to use

Related Question