Skip to content

Using OpenStreetMap to clip satellite data

clipping sat

clipping sat

Often when processing satellite imagery clipping the data to an AOI makes sense. If you just want to build up a map of one area or use it for statistics then clipping is a standard part of a GIS process. Finding reliable data to clip to, or search with, is harder than it should be. Let’s say for instance you wanted a boundary of Beverly Hills in California.

search

The first result on Google is this http://www.zipmap.net/California/Los_Angeles_County/Beverly_Hills.htm which does give me the answer but I cannot seem to be able to do anything with the data. Next result wants me to create an account to login, the next Wikipedia and so on.

I change my search to “beverly hills california shapefile”

search

Getting closer… Firstly I get an interactive map that does seem to have a download, secondly a link to arcgis.com – sadly this is just a shapefile of LA, with Beverly Hills cut out. At this point I could create a polygon from this donut polygon, but really I just want Beverly Hills area.

shapefiles

Next up the TIGER/Line dataset; this one contains 490,385 rows of data.

searching

Beverly Hills must be in there somewhere, right? This shapefile is also a line shapefile and the boundaries seem segmented when I look at the data.

Finally, the planning website planning.lacounty.gov/gis gets me (via the online portal) to the boundary.

county boundary

The fourth result on my second Google search got me to the boundary. In 2017 my expectations are that this should be much simpler and while local/county/state portals can provide excellent information I often want to be able to search on a worldwide basis.

Why is it that when I search on Google Maps I get a boundary first time! If only I could use this data!

google maps

Well, with OpenStreetMap I can!

Using http://nominatim.openstreetmap.org/

search for a name or address(forward search) or look up data by its geographic coordinate(reverse search). Each result comes with a link to a details page where you can inspect what data about the object is saved in the database and investigate how the address of the object has been computed.

openstreetmap

Nice one. So how to get this boundary out? Click on details

openstreetmao

You need the ID I have highlighted in the red box. Navigate to this page http://polygons.openstreetmap.fr/index.py and paste the ID into the box and submit query.

openstreetmap

and choose which polygon you want: it can also be simplified (which is perfect for clipping satellite data!). GeoJSON works well for me. Here is my clipped satellite image.

sat image

So next time you are looking for a generalised polygon/boundary try OpenStreetMap!

I have grouped all my previous blogs (technical stuff / tutorials / opinions / ideas) are here http://gis.acgeospatial.co.uk

I am @map_andrew on twitter

Find me on LinkedIn