Geoscience Reference
In-Depth Information
merged. The key arguments to pass to ogr2ogr are -update and -append .
In this way, a Shapefile is appended to the destination merged Shapefile, which is
updated. The following bash script demonstrates how this can be done effectively
by searching for all of the Shapefiles in the working directory and appending them
to the output, merged shapefile located in the directory merged .
#!/bin/bash
mkdir merged_shps
ogr2ogr -f 'ESRI Shapefile' merged_shps/merged.shp first.shp
for file in $(ls subsequent*.shp);
do
ogr2ogr -f
ESRI Shapefile
-update -append
merged/merged.shp $file -nln Merged
done
In many instances, a spatial subset of a dataset is required to extract a section of
a dataset for a region of interest, which contains only the features located within a
specific area and thereby reduces the file size. This can be achieved using ogr2ogr
by passing a list of coordinates that specify the bounding box of interest using the
-clipsrc argument followed by the list of coordinates specified in the following
order xmin ymin xmax ymax which respectively represents the minimal x, y
and maximum x, y of the bounding box. In the subsequent sections we will demon-
strate how other forms of clip operations can be performed using vector datasets.
ogr2ogr subset_ile-de-france.shp ile-de-france-latest.osm.pbf
multipolygons -clipsrc 1.7 48.63 2.13 48
2.5 ogrtindex
The ogrtindex program can be used to create a tileindex—a file containing a list
of the identities of several other files along with their spatial extents. A tile index is
generally used by a Web Mapping System as means of optimizing the speed of data
transfer based on location rather than loading the full vector dataset and impacting
on performance.
Usage: ogrtindex [-lnum n] [-lname name] [-f output_format]
[-write_absolute_path]
[-skip_different_projection]
[-accept_different_schemas]
output_dataset src_dataset...
 
 
Search WWH ::




Custom Search