[GRASS-dev] PostGIS manager for GRASS GIS

Martin Landa landa.martin at gmail.com
Mon Apr 2 15:00:51 EDT 2012


Hi,

2012/4/2 Mohit Kumar <mohit.kumarug08 at students.iiit.ac.in>:
>>> I am interested in making a PostGIS manager in GRASS as a GSoc 2012 task.
>>> PyGreSQL is a python module that allows easy use of database operation
>>> API
>>> from a pyhton script. So it will be like a wrapper over
>>> the database. This can be done using wxPython and will be OS independent.
>>> Sorry to bug you all, but I am very much interested in developing for
>>> GRASS.

[...]

>> there is new development ongoing for this in GRASS 7, perhaps a good
>> moment to integrate a manager. Maybe Martin has some insights for
>> us over the next days.

> Its good to know that development is ongoing for this in GRASS, I sincerely
> want to work on this as my GSoc task.

the current PostGIS-related development in G7 is not much related to
this idea. The vector engine in G7 is currently able to read PostGIS
geometry data natively without any abstract level (like OGR-PostgreSQL
driver). Also write support has been recently implemented. The current
implementation is focused on simple feature access, GRASS builds a
pseudo-like topology as for OGR links (see v.external). At this moment
I am working on PostGIS topology support in GRASS.

> I have made a brief idea for the manager. The following are the various
> modules of the manager
> 1. Setup connection : This module will set up the connection with the remote
> database. It will take the input parameters from user and pass them to a
> connection string. After the connection has been established, the user will
> be shown the various tables(maps) that are stored and other information
> about the database and the connection

This is already available in wxGUI [1]. Of course there is always a
space for any kind of improvements. But basically it's already there,
to add widgets for entering username and password is quite easy task.

> 2. View and edit data : This will display the data of the table in a window
> frame. One can view the map and modify the table values or the attributes.

Also possible in current wxGUI [2]. You just create a link using
`v.external` and display the map in the map canvas as normal GRASS
vector map. Also direct OGR access [3] is possible (no links,
pseudo-topology built on the fly)

> 3. Import to GRASS Data : This gives the user an option to save the data in
> Grass format for further processing/analysis of the data. This also gives
> user an option to discard the data which is of no use.

Possible with `v.in.ogr`. Simple wrapper based `v.in.ogr` for
importing PostGIS is already there [4].

> 4. Execute PostGis functions (geometry processing)on database and save
> output in grass data format.

This could be improvement.

> 5. SQL interface : This provides the advanced user to modify the database by
> use of direct SQL commands on the database.

> 6. Export GRASS data to PostGIS data : Convert the Grass Data to SQL
> database. First convert the Grass data to Esri Shapefile(.shp) using OGR and
> then converting that data to SQL database (shape2sql).

Why?? You can export data directly using `v.out.ogr` [5]. No need for
Shapefiles, that's bad idea.

> 7. Projection support : I was also thinking of adding projection support to
> the manager.

In which sense, do you mean on-the fly re-projection (ST_transform)?

Martin

[1] http://grass.osgeo.org/wiki/Working_with_external_data_in_GRASS_7#Using_wxGUI
[2] http://grass.osgeo.org/wiki/Working_with_external_data_in_GRASS_7#Digitize_OGR_layer_using_wxGUI
[3] http://grass.osgeo.org/wiki/Working_with_external_data_in_GRASS_7#Direct_access_to_external_data
[4] http://grass.osgeo.org/wiki/PostGIS#Import_into_GRASS
[5] http://grass.osgeo.org/wiki/PostGIS#Export_to_PostGIS

-- 
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa


More information about the grass-dev mailing list