How can I use gdal_rasterize to produce a (GeoTiff) raster mask from the polygons found in: http://openstreetmapdata.com/data/land-polygons (WGS84 Shapefile split-polygons)? I have tried variations such as:
... but all I get is a raster filled with 0. asked 13 Nov '15, 19:59 rosstrafford |
I ran this with the simplified_land_polygons shapefile (no need to go super detailed if your output file is just 2k x 1k pixels):
and it worked nicely. Note the omission of your "-b 1" which gave an error message for me. answered 13 Nov '15, 22:10 Frederik Ramm ♦ 1
Thanks Frederik, I'll give that a try shortly. Yes, I did have to get rid of the "-b 1" as well. This should get me somewhere for now. However, I would like to do a bit better. It's likely that the "simplified" polygons are considerably lower resolution (only 23 MB) than the ones I was trying to use. In the end, I want very detailed resolution - I will want to carve out tiles that are a few degrees wide, and ultimately want to get down below 100m resolution, so this dataset might not do the trick. I also see that the simplified polygons are delivered in Mercator rather that WGS84 (lat/lon). I'd like to get as far north (and south) as I can, so the WGS84 sets would be preferable. Anyway, there are 3 other datasets I could try, so I'll cross my fingers. I'll re-post back here to indicate which datasets work and don't work.
(14 Nov '15, 05:26)
rosstrafford
Hi Frederik. Using the simplified polygons also does NOT work for me. Maybe I should question my gdal/ogr library. I am using 1.11.1 built from source on SuSE 12.2. What version are you using?
(15 Nov '15, 15:34)
rosstrafford
1.10.1 on Ubuntu.
(15 Nov '15, 15:38)
Frederik Ramm ♦
Do you have any other suggestions? What I am really shooting for is to use it as a mask for DEM topography and bathymetry (to display one or the other in any given pixel). I need to get this big shapefile into 10 degree square tiles, and use these as a mask. Keeping it as vector, may actually be better (to get the resolution I need with raster would be immensely huge for the whole world), but I think that testing "inside vs outside" for each polygon will be seriously costly.
(16 Nov '15, 17:38)
rosstrafford
|