In this section, I am showing the 3 basic steps to connect PostGIS database with a widely used open source desktop based gis, QGIS.
Step1: Install PostGIS with Spatial database support extension
- If PostgreSQL is already installed è Launch ‘Application stack builder’ from startup menu in windows 7.
- Select the appropriate instance of PGSQL from dropdown list and Click NEXT.
- Expand ‘Categories’è Expand ‘Spatial Extensions’ è Select appropriate PostGIS version(1.5) for the already installed PGSQL version(8.4).
- Follow the instructions to install the PostGIS extension.
Step2: Loading spatial data into PostGIS
- Open the PgAdmin window (above installation should install a ‘Shapefile to PostGIS importer’ plugin.)
- Select the database and click on ‘Plugins’ and select ‘Shapefiel to PostGIS importer’ plugin.
- If the plugin is not available under the ‘Plugins’. We can also get it from “C:\Program Files (x86)\PostgreSQL\8.4\bin\postgisgui\shp2pgsql-gui.exe”
- Select the desired shp file to put into PostGIS.
- We need to put the appropriate SRID for the imported file. SRID column contains datum information of the imported shapefile into the PostGIS. There are unique SRID for the different projection and datum types.
- Above step feeds the spatial information into the database with two additional fields, one for vector geometry id and another for vector geometry with datum information.
Step3: Retrieving spatial data from PostGIS into Web based applications and Desktop based applications.
- We can view and project above data using Qgis(An open source GIS alternative to ESRI’s ArcGIS) in desktop based environment. Similarly, we can use Geoserver or UMN Mapserver view data in the Web.
- The core technologies behind Qgis and GRASS are similar. Qgis is easy to use, support GDAL, Python, PostGIS, and has nice GUI. In the same time we can get strength of GRASS by calling GRASS’s functionality form the QGIS.
- Install Qgis
- Open the Qgis --> Click layer--> select ‘Add from PostGIS’, which gives you the following windows.
Aucun commentaire:
Enregistrer un commentaire