Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. from pyproj import Proj, transform
  2. import pycrs
  3.  
  4. def geoToAlbersProj(lat, lon):
  5.    
  6.  
  7.     crs = pycrs.parse.from_esri_code(102003) # https://spatialreference.org/ref/esri/usa-contiguous-albers-equal-area-conic/
  8.     albersProj = Proj( crs.to_proj4())
  9.    
  10.     geoProj = Proj(init='epsg:4326')
  11.  
  12.     x2,y2 = transform(geoProj,albersProj,x1,y1)
  13.    
  14.     return x2, y2
  15.  
  16. x1,y1 = -120.011597902, 39.54719334000001
  17. x2,y2 = -119.787597902, 39.77119334
  18.  
  19. x1_proj,y1_proj = geoToAlbersProj(x1, y1)
  20. x2_proj,y2_proj = geoToAlbersProj(x2, y2)
  21.  
  22. print(x1_proj,y1_proj) # output: -2023058.2588652384 486397.6918467634
  23. print(x2_proj,y2_proj) # output -2023058.2588652384 486397.6918467634
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement