Last active
September 1, 2022 18:17
-
-
Save kallejahn/186496059f0d4bb0e9d6e6460c32055e to your computer and use it in GitHub Desktop.
dealing with to_crs while on VPN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geopandas as gpd | |
shapes = gpd.read_file('path/to/file') | |
# to_crs will mess up the first shape row with `inf` geometry | |
shapes_reproj = shapes.to_crs('EPSG:XXXX') | |
# so to avoid, flip the dataframe and run again, grabbing only the row you need | |
first = shapes.iloc[::-1].to_crs('EPSG:XXXX').iloc[-1,:] | |
# then fill in the messed up row with the good row | |
shapes_reproj.iloc[0,:] = first | |
############################################## | |
# ALTERNATIVELY, you can turn off the network projections | |
# then there's no communication for the VPN to mess up | |
# it is possible that the projection might get slightly less accurate | |
# so you should check the geometries. | |
import pyproj | |
pyproj.network.set_network_enabled(False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment