| | 1 | == User Guidelines for GIS Data == |
| | 2 | Assumes installation of the relevant tools: [wiki:InstallationGuidelinesGISData] |
| | 3 | === Display Shapefile as Overlay Layer in Sahana Eden === |
| | 4 | e.g. Country Outlines: |
| | 5 | * http://thematicmapping.org/downloads/TM_WORLD_BORDERS-0.3.zip |
| | 6 | |
| | 7 | Import into PostGIS (or use pgAdmin III GUI's Shapefile loader on plugins menu) |
| | 8 | {{{ |
| | 9 | createdb my_spatial_db |
| | 10 | createlang plpgsql my_spatial_db |
| | 11 | psql -d my_spatial_db -f /usr/share/lwpostgis.sql |
| | 12 | psql -d my_spatial_db -f /usr/share/spatial_ref_sys.sql |
| | 13 | shp2pgsql -s 4326 -I TM_WORLD_BORDERS-0.3.shp public.countries | psql -U postgres -W -d my_spatial_db |
| | 14 | }}} |
| | 15 | Get !GeoServer to serve as WMS |
| | 16 | * ''tbc'' |
| | 17 | Set up !TileCache |
| | 18 | * ''tbc'' |
| | 19 | Add WMS Layer to Sahana Eden |
| | 20 | * ''tbc'' |
| | 21 | === Convert Shapefile to an importable format === |
| | 22 | {{{ |
| | 23 | ogr2ogr -f CSV TM_WORLD_BORDERS-0.3.csv TM_WORLD_BORDERS-0.3.shp |
| | 24 | ogr2ogr -f geojson TM_WORLD_BORDERS-0.3.json TM_WORLD_BORDERS-0.3.shp |
| | 25 | }}} |
| | 26 | |
| | 27 | === PostgreSQL management === |
| | 28 | * Connect to Database (or use pgAdmin III GUI's PSQL Console on plugins menu) |
| | 29 | {{{ |
| | 30 | psql -d my_spatial_db -U username |
| | 31 | }}} |
| | 32 | * List Databases |
| | 33 | {{{ |
| | 34 | \l |
| | 35 | }}} |
| | 36 | * List Tables |
| | 37 | {{{ |
| | 38 | \d |
| | 39 | }}} |
| | 40 | * List Table structure |
| | 41 | {{{ |
| | 42 | \d tablename |
| | 43 | select field/* from tablename where field = 'value'; |
| | 44 | }}} |
| | 45 | |
| | 46 | === PostGIS functions === |
| | 47 | * Centroids |
| | 48 | {{{ |
| | 49 | SELECT name, iso2, asText(ST_Transform(ST_Centroid(the_geom), 4326)) AS centroid FROM countries; |
| | 50 | }}} |
| | 51 | ---- |
| | 52 | UserGuidelines |