I have a shapefile of points, defined by X and Y coordinates, ad the ID feature. I have at least 3 different points with the same ID number. I would like to define, for each ID, the shapefile of a circle that circumscribes the points. How can this be done in python environment? Answer there is a library that …
Tag: geopandas
Switching off all Folium tiles
I’m wondering if it’s possible to switch off all Folium tiles that have been added to a Folium Map object. By default one tile should be selected, but could be displayed a blank background? It’s an option that I thinkg could be useful to enhance the visualization of the entities that have be…
When do I need to use a GeoSeries when creating a GeoDataFrame, and when is a list enough?
I define a polygon: and create a list of random points: I want to know which points are within the polygon. I create a GeoDataFrame with a column called points, by first converting the points list to GeoSeries: Then simply do: which returns a pandas.core.series.Series of booleans, indicating which points are …
geopandas midpoint on line
I have a geopandas dataframe of linestrings. Each line string is a single line. I want to get the midpoint of the line and append the point geometry to geodataframe in a column centroid. How do I achieve this? Answer LineString has a centroid, hence case of using it solution demonstrates this with output as v…
Converting a list of coordinates to point geometry
My geopandas df looks like this: As you can see, the geometry column is a list containing longitude and latitude values. Is there an efficient way to convert them to points? This works but is very inefficient: When I put this in a loop I get TypeError: len() of unsized object Basically I need the inverse of t…
Is overlay how=’difference’ supposed to operate differently from geopandas 0.9 vs 0.10?
I was using the difference set operation for a different problem, but I would get an empty geodataframe or None type when replacing a polygon with the difference in my geodataframe. I found it to be a result of having non-intersecting polygons and doing the difference set-operation. I was wondering is this no…
Converting Geojson information to geopandas geometry
I have geojson file like this: I would like to extract the polygon information and save as polygon geometry in a geopandas data frame. I’m having trouble converting extracting this information from the geojson I would appreciate if anyone can help Answer you can construct valid geojson from you dict sni…
geopandas known intersection returns False
I have two sets of multipolygons. I want to select one polygon from one dataset (by using the matplotlib click event which works) and then select all polygons from the second dataset that intersect with it. When I plot the datasets they clearly overlap (see below) but my intersection always returns False. The…
Using Geopandas on python to create an interactive map
I’m trying to create an interactive map using this guide: This I use pycharm with anaconda environment, so I don’t understand when put my .shp file. This is the example code: Is this correct my directory? Error: Thank you in advance. Giovanni Answer You seem to have a n in your path, which is inte…
Extract values from xarray dataset using geopandas multilinestring
I have a few hundred geopandas multilinestrings that trace along an object of interest (one line each week over a few years tracing the Gulf Stream) and I want to use those lines to extract values from a few other xarray datasets to know sea surface temperature, chlorophyll-a, and other variables along this p…