[Thuban-list] proposal changes on postgisdb.py

Luiko Czub LCzub at t-online.de
Sun Jan 25 23:22:40 CET 2004


Moin folks,

I had several problems, viewing my data stored by 0.8 postgis DB in thuban
1.0.0.  You can find in the attachment the results of my hack, to solv these
problems.

I had following problems:

1.) postgisdb.py expect, that the postgis tables has a field 'gid'. I don't know
why, so I replaced the SELECT-Statements with the default rwo-id Field OID.
Why are you expecting the field 'gid' ?
All changes for this are marked with the comment 'SUBSTITUTE GID WITH OID '

2.) My geom datas are stored in postgis DB for a SRID different from
  '-1'. psgl raises the traceback 'Operation on two GEOMETRIES with different
SRIDs',
  when PostGISShapeStore.ShapesInRegion() searches for geometries. I created a
  new Method PostGISShapeStore.Srid() and .ShapesInRegion() call this know
  instead of '-1'. 
  Changes for this are marked with the comment 'SRID != -1'
  Attention: I'm not shure, that the projection of geomeries, imported from
  postgis, will be correct.

3.) I'm working with LINESTRING Geometries in postgis and there was no mapping
  for this geometry-type.
  Changes for this are marked with the comment 'ADD geomtype LINESTRING'
   
4.) My postgis tables sometimes has more than one geometry-field, but Thuban
  could not handle this. I made several changes on PostGISTable,
  SessionLoader.start_dbshapesource() and  SessionSaver.write_data_containers() 
  with the result, that a postgis table connections now needs the explicit
  geomcolumn name for the init(). 
  Changes for this are marked with the comment 'Init with geom_column_name'

Example for a changed session-file:
    <dbconnection dbtype="postgis" dbname="dfktest" port="" host="localhost"
user="mapserv" id="D1098406668"/>
    <dbshapesource geomcolumn="flaeche_geom" tablename="dfk_gebaeude"
id="D1098407052" dbconn="D1098406668"/>
    <dbshapesource geomcolumn="linie_geom" tablename="dfk_gebaeude"
id="D1098405644" dbconn="D1098406668"/>
    <map title="unbenannte Karte">
        <layer title="dfk_gebaeude.flaeche_geom" stroke_width="1"
shapestore="D1098407052" visible="true" stroke="#000000" fill="None"/>
        <layer title="dfk_gebaeude.linie_geom" stroke_width="1"
shapestore="D1098405644" visible="true" stroke="#000000" fill="None"/>
    </map>

What are your experiences with the postgis-connection? My big wish is the
possibility to connect to a view (possible in JUMP 1.1.1, but JUMP 1.1.1 also
doesn't handle multiple geometry fields at one table). 
But I think, this would need a redesign of postgisdb.py. 

If you want to test my changes, replace the files 
- load.py, save.py and postgisdb.py
in the directory
- .../lib/thuban/Thuban/Model

PS: sorry for my bad english, hope, you hav eunderstand the main problems



-- 

Gruß Luiko Czub

______________________________________________________
Luiko Czub
Weberstraße 1            Tel.:  ++49-761/8098-240
D-79249 Merzhausen       Email: lczub at t-online.de
______________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postgisdb_multi_geoms.tar.gz
Type: application/x-gzip
Size: 14064 bytes
Desc: not available
Url : http://www.intevation.de/pipermail/thuban-list/attachments/20040125/ce14c34c/postgisdb_multi_geoms.tar.gz


More information about the Thuban-list mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)