0

I've got a geopanda where I want to check if the points are on land or not. I tried using Globe land mask, but the resolution was quite poor as a lot of the points.

As I understand it I need to transform my Long/Lat to YX coordinates in order to be able to use basemap. I've written the below code but it doesn't work as it needs x, y.

I would like this to be scalable so want to avoid iterating over the geopanda if possible.

  map = Basemap(
  area_thresh=10,
  resolution="i",
  llcrnrlon=0.,
  llcrnrlat=-80.,
  urcrnrlon=360,
  urcrnrlat=80
)


ong_assets_gdf['onshore'] = map.is_land(map(ong_assets_gdf.geometry.y, ong_assets_gdf.geometry.x))
ZedIsDead
  • 105
  • 9

1 Answers1

0

Not optimal solution as it's using a loop, but managed to solve it so wanted to answer in case anyone else needs this.

map = Basemap(
  area_thresh=10,
  resolution="f",
  llcrnrlon=0.,
  llcrnrlat=-80.,
  urcrnrlon=360,
  urcrnrlat=80

)

ong_assets_gdf['onshore'] = 0

for index, row in ong_assets_gdf.iterrows():
    lat = row.geometry.y
    lon = row.geometry.x
    x, y = map(lon, lat)
    ong_assets_gdf.loc[index, 'onshore'] = map.is_land(x, y)
ZedIsDead
  • 105
  • 9