[Python] How do I extract the shapefile of a particular state from a country's shapefile?

Discussão em 'Python' iniciado por Stack, Julho 24, 2025.

  1. Stack

    Stack Membro Participativo

    I am working on urban heat island modelling and I want to sample points in my Landsat images over the boundary of Lagos, Nigeria.

    I have a shapefile of Nigeria (it downloaded with several other files, all with the same names but different extensions) and I want to select only Lagos state and use that as my sample boundary. Any idea how I can do this?

    I am working with the Google Earth Engine ee Python library. Right now, I have manually defined a square over Lagos like so:

    lagos_aoi = ee.Geometry.Rectangle([3.1, 6.4, 3.6, 6.75])


    I then used that area in the collection:

    collection = (
    ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
    .filterBounds(lagos_aoi)
    .filterDate("2021-11-01", "2024-03-31")
    .filterMetadata("CLOUD_COVER", "less_than", 20)
    )


    However, that square is too small and even encroaches into another state. Does anyone know how I can use the Lagos shapefile instead?

    I have tried this solution but I am unable to locate the shapefile I need.

    Continue reading...

Compartilhe esta Página