RWTH-EBC / uesgraphs

Graph framework for urban energy systems
MIT License
23 stars 6 forks source link

Bug: pyproj.exceptions.CRSError for current version of pyproj (2.1.3) #16

Open JSchiefelbein opened 5 years ago

JSchiefelbein commented 5 years ago

Calling example_osm.py with pyproj version 2.1.3 leads to the following error:

Traceback (most recent call last):
  File "/Users/PycharmProjects/uesgraphs/uesgraphs/examples/example_osm.py", line 202, in <module>
    main()
  File "/Users/PycharmProjects/uesgraphs/uesgraphs/examples/example_osm.py", line 26, in main
    example_district = osm_demo_three_buildings()
  File "/Users/PycharmProjects/uesgraphs/uesgraphs/examples/example_osm.py", line 64, in osm_demo_three_buildings
    check_boundary=False)
  File "/Users/PycharmProjects/uesgraphs/uesgraphs/uesgraph.py", line 1975, in from_osm
    curr_way.bounds[3])
  File "/Users/PycharmProjects/uesgraphs/uesgraphs/uesgraph.py", line 1799, in latlon2abs
    lat2=lat2)),
  File "/Users/anaconda3/lib/python3.7/site-packages/pyproj/proj.py", line 295, in __init__
    self.crs = CRS.from_user_input(projparams if projparams is not None else kwargs)
  File "/Users/anaconda3/lib/python3.7/site-packages/pyproj/crs.py", line 224, in from_user_input
    return cls(**value)
  File "/Users/anaconda3/lib/python3.7/site-packages/pyproj/crs.py", line 146, in __init__
    super(CRS, self).__init__(projstring)
  File "pyproj/_crs.pyx", line 317, in pyproj._crs._CRS.__init__
pyproj.exceptions.CRSError: Invalid projection: +proj=aea +lat1=50.7635284 +lat2=50.7637093 +type=crs: (Internal Proj Error: proj_create: Error -21: conic lat_1 = -lat_2)

Error caused by function latlon2abs() in uesgraph.py:

pyproj.Proj(
                        proj='aea',
                        lat1=lat1,
                        lat2=lat2)

Currently only tested with Mac OS 10.14.4. Seems to work fine for pyproj version 1.9.6.

MichaMans commented 5 years ago

@JSchiefelbein Thanks for raising this. What is your suggestion to solve this?

nfgalas commented 5 years ago

This can be resolved by changing def latlon2abs(geometry, lat_1, lat_2): and pyproj.Proj( proj='aea', lat_1=lat_1, lat_2=lat_2)