Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pyproj import Proj, transform
- import pycrs
- def geoToAlbersProj(lat, lon):
- crs = pycrs.parse.from_esri_code(102003) # https://spatialreference.org/ref/esri/usa-contiguous-albers-equal-area-conic/
- albersProj = Proj( crs.to_proj4())
- geoProj = Proj(init='epsg:4326')
- x2,y2 = transform(geoProj,albersProj,x1,y1)
- return x2, y2
- x1,y1 = -120.011597902, 39.54719334000001
- x2,y2 = -119.787597902, 39.77119334
- x1_proj,y1_proj = geoToAlbersProj(x1, y1)
- x2_proj,y2_proj = geoToAlbersProj(x2, y2)
- print(x1_proj,y1_proj) # output: -2023058.2588652384 486397.6918467634
- print(x2_proj,y2_proj) # output -2023058.2588652384 486397.6918467634
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement