Geography Reference
In-Depth Information
Where:
<shpfile> is the name of the .shp file to index.
<depth> (optional) is the maximum depth of the index
to create, default is 0 meaning that shptree
will calculate a reasonable default depth.
<index_format> (optional) is one of:
NL: LSB byte order, using new index format
NM: MSB byte order, using new index format
The following old format options are deprecated:
N: Native byte order
L: LSB (intel) byte order
M: MSB byte order
The default index_format on this system is: NL
Creating an index is easy, despite all the somewhat confusing options
for shptree . In fact, the defaults are usually fine, and you can just use
the following:
$ shptree earthquakes.shp
creating index of new
LSB format
As you can see, there isn't much in the way of feedback. When the
command is complete, you'll find a file with a qix extension:
$ ls -l * .qix
-rw-r--r-- 1 gsherman gsherman 72 Mar 21 01:22 earthquakes.qix
That's all there is to it. Make sure the spatial index stays with the rest
of the shapefile when you copy or move it somewhere else. The spatial
index will work with QGIS and MapServer and probably any spatial
application that used OGR for reading shapefiles.
11.4
PostGIS
PostGIS comes with a couple of utilities for moving data in and out of
a PostgreSQL database. Although you can accomplish the same results
with ogr2ogr , the utilities supplied with PostGIS have some additional
options that you will find useful. The limitation, of course, is that only
shapefiles are supported. Given the flexibility and capability of the OGR
utilities, this isn't a problem. We can still get the data from here to there
safely and in the form we need.
Importing Shapefiles
To import a shapefile into PostGIS, use the shp2pgsql command. Let's
look at the options and syntax.
 
 
 
 
Search WWH ::




Custom Search