Integration with geopandas geometries
See original GitHub issuegeopandas
is a package that reads many type of geometric datasets, including geojson, topojson and shapefiles (albeit through fiona
) and parses it into a pandas
dataframe, where the geometry
is parsed as a separate column.
It would be great if this is geometry
type is recognized in Altair to make a map easily.
Problems might arise with projections as Vega doesn’t support all EPSG projections, but EPSG:4326 equals to Mercator and that is supported.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:23 (11 by maintainers)
Top Results From Across the Web
Integration with geopandas to plot shapely geometries #608
One way would be to change plot to accept geopandas type objects, look for the 'geometry' column, and plot the 'Shapely' geometries. Currently, ......
Read more >GIS with Geopandas - Practical Data Science
Measuring Spatial Relationships: Geopandas is deeply integrated with libraries for geometric manipulations, making it easy to do things like measure the ...
Read more >Integrating with GeoPandas | VerticaPy
123. pop_est. Int Abc. continent. Varchar(32) Abc. country. Varchar(82)
1 140 Seven seas (open ocean) Fr. S. Antarctic Lands
2 2931 South America Falkland Is.
3...
Read more >Geometric Manipulations — GeoPandas 0.12.2+0.gefcb367 ...
Returns a GeoSeries of geometries representing all points within a given ... Transform the geometries of the GeoSeries using an affine transformation matrix....
Read more >Using GeoPandas for Spatial Visualization | by Paul Torres
... descartes — provides a nicer integration of Shapely geometry objects with Matplotlib. It's not needed every time but I import it just...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Got it working 😃
Load two datasets
Apply inner-join on GeoDataFrame and DataFrame (
gdf
should be on ‘left’ side anddf
on the right to maintaingeometry
properties in the resulting joined GeoDataFrame)Plot the GeoDataFrame using
<div>matplotlib
and print thehead()
. Therate
column is joined to the DataFrame.Prepare GeoDataFrame for Altair
Make the Choropleth Map
👍
I think it’s little bit simpler
But it will crush if we add Timestamp type field to DataFrame. To to avoid crashing it could be sanitized by
alt.InlineData(values = alt.utils.core.sanitize_dataframe(world).to_json(),
In general case will be great to support any object with geo_interface that is widely supported by python GIS libraries. I suggest to have a special class for this case something like:
data = alt.GeoData(world)
. I could make a PR, if it is needed.