2

I have GeoPandas dataframe:

d = {'Angle of point': plot_angles_list, 'Latitude': lat_list, 'Longitude': lon_list}
    df = pd.DataFrame(d)
    gdf = gpd.GeoDataFrame(
        df, geometry=gpd.points_from_xy(df.Longitude, df.Latitude))
    gdf.head()



   Angle of point   Latitude  Longitude                   geometry
0       79.349848  32.959723  35.808097  POINT (35.80810 32.95972)
1       79.349848  32.959723  35.809097  POINT (35.80910 32.95972)
2       79.349848  32.959723  35.810097  POINT (35.81010 32.95972)
3       79.349848  32.959723  35.811097  POINT (35.81110 32.95972)
4       79.349848  32.959723  35.812097  POINT (35.81210 32.95972)

I want to extract to a list only the points that have Angle of point value between 50 - 150, with the expection of 88-92, this values I want to append to another list.

3

You can filter your GeoDataFrame based on specific values in the columns.

In this case you can filter your GeoDataFrame to contain only points with an Angle of Point between 50 and 150. You can also do this for any other columns and values.

filtered_gdf = gdf[(gdf['Angle of point'] >= 50) & (gdf['Angle of point'] <= 150)]

If you want, you can then extract the list of points that have this point of angle if you want to append them to some other list.

list_of_filtered_points = list(filtered_gdf.geometry)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.