[postgis-users] WKT-saving instead of WKB

"Daniela Stärke" daniela.staerke at gmx.de
Mon Jul 9 07:59:34 PDT 2007


Hi Alex,

I received the mezogis-version, which you had sent.
> hi daniela,
> 
> i hardly see differences between your programs and yours: my python is
> 2.4.4 and python-cairo 1.4.0, but i hardly suspect those.
> 
> i'd rather suspect the mezogis version. before sending it to you, i had
> to adjust it to support psycopg2 (although i haven't had the failures
> you complain of).
> 

Before you sent me the mezogis version with support of psycopg2 I had installed psycopg-1.1.21. But even after uninstalling the old version and installing the new one I receive these damn error-messages and this is totally frustrating.

But I can't imagine, that this problem is caused just because of the python and the pycairo version, or???

Now I tried to look in the source-code for the file _geodata.py and somehow I have the impression, that mezogis can't reconvert the binary-coordinates in well-known-text coordinates. But I am not totally sure.

> if you haven't received the mezogis i've sent you privately, please tell
> me and i'll resend.
> 
> n.b.
> > insert into tablename ( id, name) values ( 'line', GeometryFromText (
> >  'LINESTRING (10 20, 20 30, 50 44)', -1))
> >
> should be
> 
> insert into tablename (name, geom) values ( 'line', GeometryFromText (
> 	'LINESTRING (10 20, 20 30, 50 44)', -1))
Right, I wrote  these lines just in the email and not looking in the file, where I saved them. It is obvious, that your command is the right one.

> 
> best regards,
> 
> alex
> 
> 
> Daniela Stärke wrote:
> > OK, I also had the assumption, that on my system is something different,
> than others have. 
> > I have on my system the following programs installed:
> > 
> > PostGreSQL: 8.1.5.
> > PostGis: 1.1.2
> > PyGTK:  2.10.4
> > PyGTK2: 2.10.6 
> > python-gtk: 2.10.3
> > WxGTK:  2.8.4
> > GeoTypes: 0.7.0
> > psycopg2: 2.0.6
> > python 2.4
> > python-cairo: 1.2.2
> > cairo:  1.2.4
> > 
> > 
> > A colleague of my had the idea, that mezogis can't create a geographical
> maps from the binary code of the geomtry-column.
> > When I use -Select geom from tablename- of the data, which is shown
> below
> > I get a table, but I want actually something, which shows me the shape
> of the geometry.
> > example of geometry: 
> > insert into tablename ( id, name) values ( 'line', GeometryFromText (
> >  'LINESTRING (10 20, 20 30, 50 44)', -1))
> > 
> > btw: ID is serial
> > 
> > Like, when there is a polygon I want to see a polygon and no coordinates
> of it, because you can't imagine, where these coordinates are, and how the
> polygon will look like. E.G. how the hexagon, pentagon or so look, if it
> is not regular. Or in which direction the Linestring shows.
> > 
> > Thanks in advance for your help
> > 
> > Daniela
> > 
> >> i can display this specific line with mezogis, the same i've sent to
> you
> >> previously.
> >>
> >> maybe some other software is incompatible with mezogis on your system.
> >>
> >> alex
> >>
> >> Daniela Stärke wrote:
> >>> Hi everyone,
> >>>
> >>> I wanted to know if it is possible to save a geometry-column in a
> >> database immediately in WKT-format without converting it into WKB
> automatically.
> >>> For instance when I insert the geometry-data I use the sql-command:
> >>>
> >>> insert into tablename ( id, x) values ( 'line', GeometryFromText (
> >> 'LINESTRING (10 20, 20 30, 50 44)', -1));
> >>> Then this coordinates are changed/saved in Well-Known-Binary (WKB),
> >> or??? But this changing/converting I don't want, because the program
> (mezogis),
> >> which I use to watch the content of the database crashes, when I want
> to
> >> open it.
> >>> Which means I get these messages:
> >>>
> >>> Traceback (most recent call last):
> >>>   File
> "/usr/local/lib/python2.5/site-packages/mezoGISlib/_guicore.py",
> >> line 291, in __goButton
> >>>     if self.runQuery(query) == True:
> >>>   File
> "/usr/local/lib/python2.5/site-packages/mezoGISlib/_guicore.py",
> >> line 400, in runQuery
> >>>     self.showResults(cursor, query, layer, resultset, tablelist)
> >>>   File
> "/usr/local/lib/python2.5/site-packages/mezoGISlib/_guicore.py",
> >> line 434, in showResults
> >>>     mapview = openMapView(layer.resultset)
> >>>   File
> >> "/usr/local/lib/python2.5/site-packages/mezoGISlib/_guiwindows.py",
> line 33, in openMapView
> >>>     m = MapWindow(resultset)
> >>>   File
> >> "/usr/local/lib/python2.5/site-packages/mezoGISlib/_guiwindows.py",
> line 139, in __init__
> >>>     self.canvas = MapCanvas()
> >>>   File "/usr/local/lib/python2.5/site-packages/mezoGISlib/_canvas.py",
> >> line 86, in __init__
> >>>     self.__createNewCanvas()
> >>>   File "/usr/local/lib/python2.5/site-packages/mezoGISlib/_canvas.py",
> >> line 524, in __createNewCanvas
> >>>     self.ctx = self.pixmap.cairo_create()
> >>> cairo.Error: NULL pointer
> >>>
> >>> and then this, when I want to work with a SQL-command:
> >>>
> >>> SELECT * FROM "public"."geodatenpoint";
> >>> Exception in thread Thread-14:
> >>> Traceback (most recent call last):
> >>>   File "/usr/lib/python2.5/threading.py", line 460, in __bootstrap
> >>>     self.run()
> >>>   File
> "/usr/local/lib/python2.5/site-packages/mezoGISlib/_geodata.py",
> >> line 465, in run
> >>>     gtk.gdk.threads_leave()
> >>>   File "/usr/local/lib/python2.5/site-packages/GeoTypes/_Point.py",
> line
> >> 64, in __init__
> >>>     or a psycopg cursor."""
> >>> ValueError: Second param to __init__ is not a %s
> >>>                         or a psycopg cursor.
> >>>
> >>> I had the impression, that somehow mezogis couldn't convert the WKB
> back
> >> into a "well-known-text" format. Thats why I ask, if it is possible to
> >> make an explicit statement, that insert geometry-data is not saved in
> WKB.
> >>> Thanks you for your help in advance
> >>>
> >>> Daniela
> > 
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger



More information about the postgis-users mailing list