Are there functions for conversion between different coordinate systems?
For example, Matlab has [rho,phi] = cart2pol(x,y)
for conversion from cartesian to polar coordinates. Seems like it should be in numpy or scipy.
Changing the projection is really easy to do in Geopandas with . to_crs() -function. As an input for the function, you should define the column containing the geometries, i.e. geometry in this case, and a epgs value of the projection that you want to use. Let's see how the coordinates look now.
Using numpy, you can define the following:
import numpy as np def cart2pol(x, y): rho = np.sqrt(x**2 + y**2) phi = np.arctan2(y, x) return(rho, phi) def pol2cart(rho, phi): x = rho * np.cos(phi) y = rho * np.sin(phi) return(x, y)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With