Skip to content

Performs Points-In-Polygons (PIP) for multiple points/polygons (raster index) and updates points with pixel value.

Notifications You must be signed in to change notification settings

dmofot/pnts_n_polys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Points In Poygons

Script performs point-in-polygon (PIP) for multiple points and multiple polygons (raster tile index) and updates the points shapefile with the pixel value from the correct raster.

Dependencies:

Install & Setup:

$ git clone [email protected]:dmofot/pnts_n_polys.git
$ cd pnts_n_polys
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt

Inputs:

  • points_shapefile (in EPSG 4326) - input_pnts.shp
  • input_rasters OR raster_tile_index - ./tiles/*.tif OR tile_index_4326.shp

Outputs:

  • points_updated_shapefile - input_pnts_updated.shp
  • raster_tile_index - tile_index_4326.shp

Examples:

$ python pnts_n_polys.py ./test/test_index_pnts_4326.shp ./test/tiles/*.tif
Loading rasters into tile_index_4326.shp...
Creating new index file...
Loading points from ./test/test_index_pnts_4326.shp...
Building spatial index...
Checking if points are in polygons...
Progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:01<00:00, 93.51pnts/s]
Saving updates to ./test/test_index_pnts_4326_updated.shp...
$ python pnts_n_polys.py ./test/test_index_pnts_4326.shp ./test/tile_index_4326.shp
Loading raster tile index ./test/tile_index_4326.shp...
Loading points from ./test/test_index_pnts_4326.shp...
Building spatial index...
Checking if points are in polygons...
Progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:01<00:00, 96.31pnts/s]
Saving updates to ./test/test_index_pnts_4326_updated.shp...

About

Performs Points-In-Polygons (PIP) for multiple points/polygons (raster index) and updates points with pixel value.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages