PostGIS - Tipps und Tricks: Unterschied zwischen den Versionen

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche
Zeile 22: Zeile 22:
 
* [http://www.thetimoneygroup.net/foss/ thetimoneygroup.net] - On-the-Fly Spatial Analysis With PostGIS and Google Earth.
 
* [http://www.thetimoneygroup.net/foss/ thetimoneygroup.net] - On-the-Fly Spatial Analysis With PostGIS and Google Earth.
 
* ([http://www.oracle.com/technology/pub/articles/schalk-googlemaps.html mit Oracle XML-DB]).
 
* ([http://www.oracle.com/technology/pub/articles/schalk-googlemaps.html mit Oracle XML-DB]).
 +
 +
== Von PostGIS direkt nach Google Earth ==
 +
 +
Man starte psql (Beispiel mit Box um Victoria, BC, Kanada):
 +
 +
  -- Set output to unaligned
 +
  \a
 +
  -- Show only tuples
 +
  \t
 +
  -- Dump query to a file
 +
  \o my_kml_file.kml
 +
  -- Run your query
 +
  SELECT askml('my_line', 'description', 'SRID=3005;LINESTRING( 1190000
 +
  390000, 1200000 390000, 1200000 380000, 1190000 380000, 1190000 390000
 +
  )'::geometry);
 +
  -- Flush output your file and close the output stream
 +
  \o
 +
 +
Dann Doppelklick auf die KML-Datei und Google Earth startet!

Version vom 9. Oktober 2007, 03:20 Uhr

Siehe auch

SRID

Der SRID (projection identifier) wird an drei Orten verwaltet:

  • In der geometry column: select SRID(the_geom) from mytable limit 5;
  • As a constraint on the table for the geometry column: \d mytable
  • In the geometry_columns system table: select * from geometry_columns;

Mit der Methode UpdateGeometrySRID([<schema_name>], <table_name>, <column_name>, <srid>) kann man

shp2pgsql

Man beachte beim Import von Shapefiles das .prj File. Ohne weitere Angaben wird der SRID auf -1 gesetzt. Siehe SRID (Quelle).

Eine Alternative zu shp2pgsql ist ogr2ogr von OGR.

Mit einfachster Webapplikation und PostGIS zur Online-Karte

Von PostGIS direkt nach Google Earth

Man starte psql (Beispiel mit Box um Victoria, BC, Kanada):

 -- Set output to unaligned
 \a
 -- Show only tuples
 \t
 -- Dump query to a file
 \o my_kml_file.kml
 -- Run your query
 SELECT askml('my_line', 'description', 'SRID=3005;LINESTRING( 1190000
 390000, 1200000 390000, 1200000 380000, 1190000 380000, 1190000 390000
 )'::geometry);
 -- Flush output your file and close the output stream
 \o

Dann Doppelklick auf die KML-Datei und Google Earth startet!