Open tynowell opened 4 years ago
Nice, clean extension. Very Nice! However, I've had no luck with it so far. I get a type error when to_postgis is called.
... in _extract_srid_int_from_crs return int(self._obj.crs['init'].replace('epsg:', '')) TypeError: 'CRS' object is not subscriptable
My pandas dataframe is in this format:
id x y 0 0 201450.14 6580070.72 1 1 196845.05 6521476.19 2 2 196840.15 6581111.00
Which is then converted to a geopandas dataframe:
gdf = geopandas.GeoDataFrame(df['id'], crs=6173, geometry=geopandas.points_from_xy(df.x, df.y))
gdf.crs is a pyproj.crs.crs.CRS type which is not scriptable. Calling the crs attribute returns:
gdf.crs
pyproj.crs.crs.CRS
<Compound CRS: EPSG:6173> Name: ETRS89 / UTM zone 33 + NN54 height Axis Info [cartesian|vertical]: - E[east]: Easting (metre) - N[north]: Northing (metre) - H[up]: Gravity-related height (metre) Area of Use: - name: Norway - onshore - 12°E to 18°E - bounds: (12.0, 59.88, 18.01, 69.68) Datum: European Terrestrial Reference System 1989 - Ellipsoid: GRS 1980 - Prime Meridian: Greenwich Sub CRS: - ETRS89 / UTM zone 33N - NN54 height
to_postgis is then called:
to_postgis
gdf.postgis.to_postgis(con=conn, table_name='test', geometry='Point')
I tried adding srid=6173 as a parameter but that is overwritten in the call anyway.
As mentioned in #7, I think this would a great addition to geopandas. If I have time, I'll create a pull request with a fix.
Nice, clean extension. Very Nice! However, I've had no luck with it so far. I get a type error when to_postgis is called.
My pandas dataframe is in this format:
Which is then converted to a geopandas dataframe:
gdf = geopandas.GeoDataFrame(df['id'], crs=6173, geometry=geopandas.points_from_xy(df.x, df.y))
gdf.crs
is apyproj.crs.crs.CRS
type which is not scriptable. Calling the crs attribute returns:to_postgis
is then called:gdf.postgis.to_postgis(con=conn, table_name='test', geometry='Point')
I tried adding srid=6173 as a parameter but that is overwritten in the call anyway.
As mentioned in #7, I think this would a great addition to geopandas. If I have time, I'll create a pull request with a fix.