PostGIS Terminal: Unterschied zwischen den Versionen
Stefan (Diskussion | Beiträge) (→XAPI-to-Map) |
Stefan (Diskussion | Beiträge) |
||
Zeile 1: | Zeile 1: | ||
[[Bild:PostGIS_Terminal.jpg|thumb|300px|right|Printscreen of PostGIS Terminal (Prototype).]] | [[Bild:PostGIS_Terminal.jpg|thumb|300px|right|Printscreen of PostGIS Terminal (Prototype).]] | ||
− | |||
− | |||
'PostGIS Terminal' (short PT) is a webapplication to query [[PostGIS]] database using pure SQL and see the result in a map window. The background map and geodata comes from [[OpenStreetMap]]. It's mainly a rich client written in JavaScript with some server code currently in PHP. | 'PostGIS Terminal' (short PT) is a webapplication to query [[PostGIS]] database using pure SQL and see the result in a map window. The background map and geodata comes from [[OpenStreetMap]]. It's mainly a rich client written in JavaScript with some server code currently in PHP. | ||
>>> '''Got to [http://labs.geometa.info/postgisterminal/?xapi=node%5Bname%3DHochschule%20Rapperswil%5D PostGIS Terminal]''' - ''NOTE: Use with care! There is no warrranty about availability!'' <<< | >>> '''Got to [http://labs.geometa.info/postgisterminal/?xapi=node%5Bname%3DHochschule%20Rapperswil%5D PostGIS Terminal]''' - ''NOTE: Use with care! There is no warrranty about availability!'' <<< | ||
+ | |||
+ | == About == | ||
+ | |||
PostGIS Terminal was developed based on the idea and implementation of Marc Jansen and Till Adams german OpenLayers book (see [http://openlayers-buch.de/beispiele/chapter-09/postgis-terminal.html] and [http://2010.foss4g.org/presentations_show.php?id=3630]). There's another implementation behind [http://www.postgisonline.org/ postgisonline.org]. | PostGIS Terminal was developed based on the idea and implementation of Marc Jansen and Till Adams german OpenLayers book (see [http://openlayers-buch.de/beispiele/chapter-09/postgis-terminal.html] and [http://2010.foss4g.org/presentations_show.php?id=3630]). There's another implementation behind [http://www.postgisonline.org/ postgisonline.org]. |
Version vom 28. August 2011, 21:07 Uhr
'PostGIS Terminal' (short PT) is a webapplication to query PostGIS database using pure SQL and see the result in a map window. The background map and geodata comes from OpenStreetMap. It's mainly a rich client written in JavaScript with some server code currently in PHP.
>>> Got to PostGIS Terminal - NOTE: Use with care! There is no warrranty about availability! <<<
Inhaltsverzeichnis
About
PostGIS Terminal was developed based on the idea and implementation of Marc Jansen and Till Adams german OpenLayers book (see [1] and [2]). There's another implementation behind postgisonline.org.
Preconditions/Dependencies: Apache (with PHP support), PostgreSQL (8 or 9), PostGIS (>=1.5) plus OpenLayers (). There are no other SW dependencies.
Notes (in german): Das PostGIS Terminal ist eine Art Webadmin-Tool zur Visualisierung von Spatial SQL Queries und kann für Ausbildungzwecke aber auch für GIS-Administratoren nützlich sein. Installieren siehe _README.txt. Es gibt ev. mal eine Homepage auf http://labs.geometa.info/ (analog http://openlayers-buch.de/beispiele/chapter-09/postgis-terminal.html ). Setzt Apache/PHP und PostgresSQL/PostGIS voraus. Passende Daten dazu stammen beispielsweise von OpenStreetMap (http://download.geofabrik.de/osm/ ). Testen mit den Beispielen in _EXAMPLE_QUERIES.txt und nice-queries-for-postgis-console.sql. Könnte theoretisch auch weitere Geo-Datenbanksysteme unterstützen (müsste dann aber umbenannt werden).
How to use it
WKT ( ST_AsText(...) ) is being displayed in map window.
The result of a query (resultset)...
- SELECT WKT... FROM ... => map
- SELECT ST_AsText(...) AS geom FROM ... => map
- SELECT ST_AsText(...) AS geom, name as label FROM ... => map with text label
else => output goes to log window.
Credits / License
Credits to...
- Marc Jansen/Till Adams (code, OpenLayers book)
- and Hartmut Holzgräfe (code)
- and the fabulous OpenStreetMappers (data).
Software is licensed under "New BSD License" (see http://en.wikipedia.org/wiki/BSD_licenses ).
Terms of Use
Help
Database
- Tables and Attributes
- You can find out more about the actual database by clicking on the '?' button right to 'Database'. To find out the attribute names, you can do a: "SELECT * from osm_point"
- Schema
- For a more information about the database see 'Enhanced OpenStreetMap Database One' (EOSMDBOne).
- Key/Value Pairs
- If you are searching for the right keys and values, try Taginfo (http://taginfo.openstreetmap.ch/); e.g. search for key 'tourism', then click on the key again and you get the values, like 'zoo' (which makes "tourism = zoo"). See also 'Map Features' on OSM Wiki.
SQL Help
To be defined. The use of selectors which "generate" SQL into query input console is experimental from an eLearning view.
Help using PostGIS Terminal
PostGIS Terminal analyses your SQL query (from your input into the Query editor), beautifies it and looks for placeholders. Output (text or map) can be controlled with field names (or function names) if they exist in the SQL console input or in the query result.
Output can go to
- log window (called "text query") or to
- map window (called "map query").
"map queries" can be either be "geometry" (= point, linestring, polygon) or "marker" (= icon).
.--------------------------. | PostGIS Terminal... | |--------------------------| | xxx | | | | | | Query: | | | ####### | Map Window | | ####### | | | | | | Log: | | | ####### |----------------| | ####### | Footer | .--------------------------. Figure: GUI Layout of PostGIS Terminal.
Reserved field and function names are:
- "geom" : field with WKT geometry.
- "label : field with text displayed as a label of the geometry.
- mapextent(): bbox of current map view.
System variable placeholder:
- _table: for current Table/name name.
- _geom: for Geometry attribute name.
- _string: for Search name.
- _mouse_x/_mouse_y: for each mouse click in map window.
See e.g. examples below.
Examples
See also POIs for other frequently used tags.
Zoos der Schweiz:
SELECT ST_AsText(way) AS geom, name||' '||osm_id AS label, tags FROM osm_all WHERE tags @> hstore('tourism','zoo')
Schweizer Kernkraftwerke mit 40 Km-Puffer:
SELECT ST_AsText(ST_Buffer(ST_Centroid(way),40000)) AS geom, name AS label FROM osm_all WHERE tags @> hstore('generator:source','nuclear')
Alle Restaurants mit Namen 'Rössli' der Schweiz:
SELECT ST_AsText(way) AS geom, name AS label FROM osm_point WHERE amenity = 'restaurant' AND name ILIKE '%rössli%'
Alle 4000er Berggipfel der Schweiz:
SELECT ST_AsText(way) AS geom, name||','||ele AS label FROM osm_point WHERE "natural" = 'peak' AND to_number(ele, '9999') >= 4000
Alle Picnic-Plätze und Aussichtspunkte im aktuellen Kartenausschnitt:
SELECT ST_AsText(way) AS geom, name AS label FROM osm_point WHERE tourism IN ('picnic_site','viewpoint') AND ST_Contains(mapextent(), way)
XAPI-to-Map
NOTE: This functionality is early beta!
You can query the PostGIS-Terminal by using the XAPI syntax from OSM, like this:
- Zoos: http://labs.geometa.info/postgisterminal/?xapi=node[tourism=zoo] [3]
- Castles: http://labs.geometa.info/postgisterminal/?xapi=node[historic=castle] [4]
- Viewpoints: http://labs.geometa.info/postgisterminal/?xapi=node[tourism=viewpoint] [5]
Feedback
See >>> Diskussion:PostGIS_Terminal <<<
Download and Installation
- There's no download yet (pls. send request as e-mail).
- Installation, readme and more are included in the delivery (zip file).