question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make `GeoDataFrame._to_geo` "public"

See original GitHub issue

Currently GeoDataFrame.to_json uses GeoDataFrame._to_geo to get JSON (string) representation of GeoDataFrame.

But GeoDataFrame._to_geo is 'private" (prefixed). So we can get string representation of GeoDataFrame but not dictionary.

Proposition: make GeoDataFrame._to_geo “public”.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kuragacommented, Mar 7, 2020

Not sure if there are any other differences between these two, but you certainly want to preserve CRS.

They are, one of them I pointed above: GeoJSON puts id property inside properties dictionary but to_json puts it beside properties.

0reactions
martinfleiscommented, Feb 19, 2022

GeoDataFrame.__geo_interface__ is a public API for _to_geo that returns the original dictionary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a GeoDataFrame from a DataFrame with coordinates
This example shows how to create a GeoDataFrame when starting from a regular DataFrame that has coordinates either WKT (well-known text) format, or...
Read more >
How to use the geopandas.sjoin function in geopandas - Snyk
To help you get started, we've selected a few geopandas.sjoin examples, based on popular ways it is used in public projects.
Read more >
How to convert a GeoSeries to a GeoDataFrame with ...
I successfully opened a shapefile and made a union of all entity and an envelope. As it said in GeoPandas doc, after these...
Read more >
Count Points in Polygon and write result to (Geo)Dataframe
But that does not add a column to the GeoDataframe df_poly with the count of each group . python · pandas · geopandas...
Read more >
Have GeoDataFrame return regular DataFrame if no geometry ...
If it returns a GeoDataFrame, then any calls to 'geo' methods will result ... Would it make sense to create a geometry column...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found