[gdal-dev] Shapefile to Arc/info ascii
Frank Warmerdam
warmerdam at pobox.com
Thu Sep 3 11:33:44 EDT 2009
Jonas Malmqvist wrote:
> Hi all,
> I've been looking around in your mailing list searching for a way to
> convert a vector shapefile to a raster Arc/Info ascii format but haven't
> found any applicable example. It seems like rasterize could be a
> solution in the GDAL library but I don't get how. The steps I'm aiming
> to perform are the ones below, can GDAL do that?
>
> *Put together a mosaic of several shape files into one single shape file.
Jonas,
ogr2ogr with the -update and -append switches can be used to concatenate
several compatible shapefiles into one. The source files should have
essentially the same set of attributes and a compatible geometry type.
> *Crop a rectangular area of the new shape file.
ogr2ogr can extract only the features that intersect a particular
rectangle using the -spat switch. However, the features that are partly
inside, and partly outside are not clipped to the rectangle - you get
the whole feature.
> *Rasterize the new shapefile file (all shapes should be used) with a
> specific resolution in x and y and specify which attribute column that
> should be rasterized.
The gdal_rasterize command can handle the rasterization (use -a to
select the attribute field to burn in), but you will have to precreate
the file with the desired georeferenced region and resolution. This
can often be accomplished through suitable use of gdal_translate or it
can be easily done in a gdal script (python, etc).
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list