28.05.2013 Views

QGIS User Guide - OSGeo Download Server

QGIS User Guide - OSGeo Download Server

QGIS User Guide - OSGeo Download Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.2.5. Migliorare le prestazioni<br />

5.2 Layer PostGIS<br />

Richiamare dati geografici da un database PostgreSQL può richiedere molto tempo, specialmente<br />

se il server dei dati si trova in rete. È possibile migliorare le prestazioni di resa a video di layer<br />

PostgreSQL assicurandosi di creare un indice spaziale su ogni layer nel database. PostGIS supporta<br />

la creazione di un indice GiST (indice dell’albero generalizzato di ricerca, Generalized Search Tree)<br />

per velocizzare le ricerche spaziali di dati.<br />

La sintassi per la creazione di un indice GiST è: 3<br />

CREATE INDEX [indexname] ON [tablename]<br />

USING GIST ( [geometryfield] GIST_GEOMETRY_OPS );<br />

Si noti che per tabelle molto grandi, la creazione dell’indice può richiedere parecchio tempo.<br />

Non appena l’indice è stato creato, bisognerebbe effettuare una VACUUM ANALYZE. Si veda la<br />

documentazione di PostGIS [4] per ulteriori informazioni.<br />

Ciò che segue è un esempio di come creare un indice GiST:<br />

gsherman@madison:~/current$ psql gis_data<br />

Welcome to psql 8.3.0, the PostgreSQL interactive terminal.<br />

Type: \copyright for distribution terms<br />

\h for help with SQL commands<br />

\? for help with psql commands<br />

\g or terminate with semicolon to execute query<br />

\q to quit<br />

gis_data=# CREATE INDEX sidx_alaska_lakes ON alaska_lakes<br />

gis_data-# USING GIST (the_geom GIST_GEOMETRY_OPS);<br />

CREATE INDEX<br />

gis_data=# VACUUM ANALYZE alaska_lakes;<br />

VACUUM<br />

gis_data=# \q<br />

gsherman@madison:~/current$<br />

5.2.6. Layer vettoriali che attraversano 180 ◦ di longitudine<br />

Many GIS packages don’t wrap vector maps, with a geographic reference system (lat/lon), crossing<br />

the 180 ◦ longitude line. As result, if we open such map in <strong>QGIS</strong>, we will see two far, distinct locations,<br />

3 le informazioni sull’indice GiST sono tratte dalla documentazione PostGIS disponibile su<br />

http://postgis.refractions.net<br />

<strong>QGIS</strong> 1.4.0 <strong>User</strong> <strong>Guide</strong> 45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!