3

I have a 0.05 deg global maps (~8000 files) in GeoTiff format. It's a kind of a mask containig "1" and "0". I need to create a point shapefile for each raster with points located over "1" values of raster.

I tried to do this in QGIS via this tutorial http://www.qgistutorials.com/en/docs/sampling_raster_data.html, but creating a shapefile with ~26M of points and sampling it over each raster is quite slow.

Is there a better way to do this, preferably with gdal/ogr?

  • Welcome to GIS SE! As a new user be sure to take the Tour. What GIS software are you using? What have you tried prior to posting (research effort is expected)? And where are you stuck? – PolyGeo Nov 24 '15 at 2:56
  • In most GIS, this is a matter of using a tool called something like "raster to points," and then querying-out the ones the attribute value 1. Other ways are possible too. If you post what software you're using or open to using, you can get more specific help. – Paulo Raposo Nov 24 '15 at 3:57
2

A way to achieve this is to use GRASS's r.to.vect tool, through QGIS, which will give you a vector point for each pixel (i.e., choose points in the parameters). Then, query out those points with the desired value (i.e., 1, in this case).

  • It works fine (slow, actually), but the problem is i need to process ~8000 rasters. I should specify that in the question. The solution with python will be perfect if it works. – John Smith Dec 4 '15 at 0:57
  • 1
    If you change to GRASS CLI (command line interface) you can simply write a shell script or bat file to go through all files and repeat the same GRASS command. Python scripts are also supported. – Zoltan Oct 12 '16 at 5:59
0

For anyone looking at this question this has been already answered here:

GDAL and Python: How to get coordinates for all cells having a specific value?

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.