4 votes

Interpolate intermediate sections

You can use geopandas.GeoSeries.translate Original translated = gdf.geometry.translate(50) # 1 in your case Result
gene's user avatar
  • 54.7k
4 votes
Accepted

Aggregating points into polylines, sorted by timestamp using GeoPandas/Python

Sort by id and date, groupby id and agg into linestrings: import geopandas as gpd from shapely.geometry import LineString df = gpd.read_file(r"/home/bera/Desktop/gistest/gps_points.shp") #...
BERA's user avatar
  • 71.2k
3 votes

Dropping nearly-identical point locations with GeoPandas

You can round the coordinates of the geometries first using shapely.set_precision: # Round the coordinates to 5 decimals gdf.geometry = shapely.set_precision(gdf.geometry, grid_size=0.00001) Note: in ...
Pieter's user avatar
  • 1,465
3 votes

Dropping nearly-identical point locations with GeoPandas

You could just create new columns based on your point geometry, round it, and then use drop_duplicates(), e.g.: gdf["x"] = round(gdf.geometry.x, 5) gdf["y"] = round(gdf.geometry.y, ...
NielsFlohr's user avatar
2 votes
Accepted

DataFrame to GeoDataFrame Error: could not convert string to float

Decimal separator I think you live in a country with comma separator instead of point as i can see from your screenshot. https://en.wikipedia.org/wiki/Decimal_separator Python needs points and doesn't ...
Xeppit's user avatar
  • 1,215
2 votes
Accepted

Why the buffer geometry column in the GeoDataFrame is in point form although it's actually in polygon form?

You have a typo in your read_file call. You use parameter layers="buffers" instead of layer="buffers". So: shopping_centre_buffers = geopandas.read_file( DATA_DIRECTORY / "...
Pieter's user avatar
  • 1,465
1 vote

Dropping nearly-identical point locations with GeoPandas

You can round off the coordinates to a desired precision level, which is not obvious with geopandas. See here. from shapely.ops import transform def round_coordinates(geom, ndigits=2): def ...
Shawn's user avatar
  • 1,717
1 vote
Accepted

Get attributes of overlapping polygons intersecting a point geometry

Your logic should work, it does with my data. Point 1 doesnt intersect a polygon so because of inner join it is dropped. Point 2 intersects polygon 1, so it gets the polygon data joined to it. Point 3 ...
BERA's user avatar
  • 71.2k
1 vote
Accepted

Interpolate intermediate sections

Assuming that the distance is measured between the middle points of those lines, you could: find their middle points find how many more points must be between those middle points to keep the distance ...
Ratislaus's user avatar
  • 184
1 vote
Accepted

After converting CSV file to polygon, polygons are not falling on correct location

A better solution is to use directly geopandas.GeoSeries.from_wkt df = pd.read_csv("Test_Polygon.csv") print(df.boundary[0]) POLYGON ((87.7185491791352 22.5667828312016, 87.7184590804737 ...
gene's user avatar
  • 54.7k
1 vote

After converting CSV file to polygon, polygons are not falling on correct location

Swapping the values placed the geometry on correct location. Here's the modified the code: import geopandas as gpd import pandas as pd from shapely.geometry import Polygon df = pd.read_csv(r"/...
gis's user avatar
  • 123
1 vote

Intersecting a circle and a geodataframe

You are doing a left join (how="left"), so (only) the geometry of the left_df, so the circle, is retained in the output as explained in the documentation of the how parameter here. If I ...
Pieter's user avatar
  • 1,465
1 vote
Accepted

Intersecting a circle and a geodataframe

You need to set a crs when you create the circle df: circle_gdf=gpd.GeoDataFrame(geometry=[circle], crs=????)
BERA's user avatar
  • 71.2k
1 vote

Including length when making a networkx network from a geodataframe

The geometry and the properties of the GeoDataFrame are still present in the graph, you can see them in using data=True (and the length is 'mm_len') (see How to calculate edge length in Networkx) With ...
gene's user avatar
  • 54.7k
1 vote

Get the name of the geometry column(s) of a GeoDataFrame

In geopandas 0.14.2, there is an easier way to find the active geometry column. (I'm not sure what version this started in). gdf.geometry.name You can also use the attribute gdf.geometry to always ...
Rejexx's user avatar
  • 13
1 vote
Accepted

Tell GeoPandas the number of significant figures to use when writing GeoJSON geometries

When dealing with polygons, rounding coordinates is something to be handled with care, as the rounding can lead to self-intersections, parts collapsing to lines,... The safe way to do this is to use ...
Pieter's user avatar
  • 1,465
1 vote

Rounding coordinates to five decimals in GeoPandas

Since december 2022, shapely.set_precision has been available for this purpose. This function will round the coordinates but will also make sure the output is a valid geometry, as with polygons just ...
Pieter's user avatar
  • 1,465
1 vote

How to extract biggest Polygon from MultiPolygon in GeoPandas?

As of shapely 2.0.2 (and may be earlier versions), you need to append .geoms: max(multipolygon.geoms, key=lambda a: a.area)
Victor Boussange's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible