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?

John Smith
  • 41
  • 1
  • 4
  • 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 02: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 03:57

2 Answers2

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).

Paulo Raposo
  • 1,930
  • 14
  • 21
  • 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 04 '15 at 00: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 05: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?

Marcelo Villa
  • 5,928
  • 2
  • 19
  • 38