0

I want to calculate distance between two lat/log point using geopandas series.distance and measure the result by unit meters, I know I should define crs first, but I tried several times to use to_crs(), but it is showing an error: b'no arguments in initialization list' seems like the function never worked. Anyone can help me on this problem?

def wgs84_to_CGCS2000(df,code):
    result=df.to_crs(from_epsg(code))
    return result
city=wgs84_to_CGCS2000(city,4549)
kfc=wgs84_to_CGCS2000(kfc,4549)
RuntimeError                              Traceback (most recent call last)
<ipython-input-42-c0d1c4e6af6a> in <module>
      2     result=df.to_crs(from_epsg(code))
      3     return result
----> 4 city=wgs84_to_CGCS2000(city,4549)
      5 kfc=wgs84_to_CGCS2000(kfc,4549)

<ipython-input-42-c0d1c4e6af6a> in wgs84_to_CGCS2000(df, code)
      1 def wgs84_to_CGCS2000(df,code):
----> 2     result=df.to_crs(from_epsg(code))
      3     return result
      4 city=wgs84_to_CGCS2000(city,4549)
      5 kfc=wgs84_to_CGCS2000(kfc,4549)

C:\ProgramData\Anaconda3\lib\site-packages\geopandas\geodataframe.py in to_crs(self, crs, epsg, inplace)
    441         else:
    442             df = self.copy()
--> 443         geom = df.geometry.to_crs(crs=crs, epsg=epsg)
    444         df.geometry = geom
    445         df.crs = geom.crs

C:\ProgramData\Anaconda3\lib\site-packages\geopandas\geoseries.py in to_crs(self, crs, epsg)
    302             except TypeError:
    303                 raise TypeError('Must set either crs or epsg for output.')
--> 304         proj_in = pyproj.Proj(self.crs, preserve_units=True)
    305         proj_out = pyproj.Proj(crs, preserve_units=True)
    306         project = partial(pyproj.transform, proj_in, proj_out)

C:\ProgramData\Anaconda3\lib\site-packages\pyproj\__init__.py in __new__(self, projparams, preserve_units, **kwargs)
    360         # on case-insensitive filesystems).
    361         projstring = projstring.replace('EPSG','epsg')
--> 362         return _proj.Proj.__new__(self, projstring)
    363 
    364     def __call__(self, *args, **kw):

_proj.pyx in _proj.Proj.__cinit__()

RuntimeError: b'no arguments in initialization list'
Vlad
  • 8,225
  • 5
  • 33
  • 45
bartyan
  • 1
  • 1
  • Possible duplicate of [RuntimeError: b'no arguments in initialization list'](https://stackoverflow.com/questions/55390492/runtimeerror-bno-arguments-in-initialization-list) – jimf May 07 '19 at 13:48
  • What version of pyproj do you have? (`import pyproj; pyproj.__version__`) How did you install pyproj? (with `conda` ?) – joris May 07 '19 at 14:03

0 Answers0