I am trying to get just the datapoints that intersect with the boundaries of a GeoTiff image for some internal testing on an algorithm.

Are there any tools that can perform this operation?

If not, how would I script this behavior?

I would also like to preserve as much as data as possible from the original OSM file such as tags and other attributes.

I seek a solution that uses GDAL.

Here are the steps I need to perform:

  1. Get the bounding box of the GeoTiff

  2. Find all entries that intersect with those boundaries

  3. Save those entries to a new OSM file.


Okay so I found an easy way to do this for anyone interested.

  1. Get the bounding box of the Geotif using the command line utility gdalinfo

  2. Use osmconvert -b"bottom_left_lat","bottom_left_long","top_left_lat","top_left_long" to extract the geotiff

    1. Enjoy your cropped OSM file!

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.