Category : geopandas

hi so I’m trying to import geopandas into my script import pandas as pd import geopandas as gpd from shapely.geometry import Point #handling txt #remove ‘lat=’ and ‘long=’ then type change from object to float to make point. df = pd.read_csv(‘latlong.txt’, header=None, names = [‘lat’,’long’, ‘name’,’description’]) df[‘lat’] = df[‘lat’].str.replace(‘lat=’, ”) df[‘long’] = df[‘long’].str.replace(‘long=’, ”) df[‘lat’] ..

Read more

I want to count how many points there are per Polygon # Credits of this code go to: https://stackoverflow.com/questions/69642668/the-indices-of-the-two-geoseries-are-different-understanding-indices/69644010#69644010 import pandas as pd import numpy as np import geopandas as gpd import shapely.geometry import requests # source some points and polygons # fmt: off dfp = pd.read_html("https://www.latlong.net/category/cities-235-15.html")[0] dfp = gpd.GeoDataFrame(dfp, geometry=dfp.loc[:,["Longitude", "Latitude",]].apply(shapely.geometry.Point, axis=1)) res = ..

Read more

I have a dataframe, which is a spatial data with coordinates and multiple other entries. df.columns=[‘longitude’,’latitude’,….,’data’] If I have the coordinates of a line profile, profile=[(x1,y1),(x2,y2)] and consider the profile have a custom width (5 km), How to extract the data rows in the dataframe which falls inside this profile? (Is there a particular function ..

Read more

I have two dataframes, one is a GeoPandas dataframe, gdf, the other is a regular Pandas dataframe, scores. I’ve provided a look at both below. In[35]: gdf.head() Out[35]: TYPE TILE SHADOW geometry 0 DOWNED AA-55 N LINESTRING (-10393395.743 3537714.885, -103933… 1 DOWNED AA-58 Y LINESTRING (-10393417.905 3536848.899, -103934… 2 DOWNED AA-64 N LINESTRING (-10393362.034 3534592.812, ..

Read more