DOC: add example of simple joining two GeoSeries together (append)
See original GitHub issueI am writing (extremely basic) script using Geopandas and I am stuck a bit due to missing documentation.
I was happy to fing “merging data” at http://geopandas.org/mergingdata.html because I run into TypeError: unsupported operand type(s) for +: 'GeometryArray' and 'GeometryArray'
on attempting to merge data split into two such objects.
Sadly, “Merging Data” docs page is not covering simplest possible way of merging data.
For reference my code:
data = gpd.read_file(in_file)
if "waterway" in data:
rivers = []
streams = []
rivers = data[data["waterway"] == "river"]
rivers.geometry = rivers['geometry'].buffer(0.000250)
streams = data[data["waterway"] == "stream"]
streams.geometry = rivers['geometry'].buffer(0.000025)
(rivers + streams).to_file(out_file, driver = 'GeoJSON')
EDIT: I asked https://gis.stackexchange.com/questions/340463/merge-two-geometryarray-into-one-one-geometryarray-in-geopandas
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Merging Data — GeoPandas 0.12.2+0.gefcb367.dirty ...
In a Spatial Join, observations from two GeoSeries or GeoDataFrame are combined based on their spatial relationship to one another.
Read more >GeoPandas Documentation - Read the Docs
There are two ways to combine datasets in geopandas – attribute joins and spatial joins. In an attribute join, a GeoSeries or GeoDataFrame...
Read more >Joins in Python- Merging, Appending and Aggregating Data
We can use the simple merge() function for merging data in pandas. First, we import the two datasets as sal_data and bonus_data using...
Read more >Relations and spatial joins with vector data - PySAL
For example, the following plot shows the neighborhoods and listing data ... To join two spatial tables together using a spatial join, you...
Read more >Merge Data & Dissolve Polygons — Python Open ... - PyGIS
Dataframes are widely used in Python for manipulating data. Recall that a dataframe is essentially an Excel spreadsheet (a 2-D table of rows...
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
You are looking for simple
append
. Reproducible example:Your example:
But yeah, we might add it to docs.
You can check #524 and #529. But first check what is already included on geopandas.readthedocs.io and in examples folder.