
On 2011-05-04 16:56, Georgios Garmpis wrote:
"...and you get an extra WKT->WKB conversion because the select produces a textual representation of the column. ..." You mean "WKB->WKT conversion", don't you?
Undoubtedly I did.
Why is this last conversion needed? Isn't it extra work for monetdb?
This has to do with the way data is sent from the server to the client.
Is there any way to tweak the code in order to bypass the last conversion ?
Only by not sending the results to the client. If you want to do something with the results in your client application, you will need to send them, but if you want to work further using SQL, you should try to keep the data inside the server, for instance by storing them in a temporary table. There is currently no way to avoid the WKB->WKT conversion in the client-server protocol.
On Wed, Apr 27, 2011 at 4:36 PM, Sjoerd Mullender <sjoerd@acm.org <mailto:sjoerd@acm.org>> wrote:
On 2011-04-27 14:52, Kostis Kyzirakos wrote: > In Postgres the WKB representation of a geometry is returned as a byte > array. > For example, > > LGD=# SELECT ST_AsBinary(ST_GeomFromText('POINT(1 2)',-1)); > st_asbinary > ---------------------------------------------- > \x0101000000000000000000f03f0000000000000040 > (1 row)
This is not available in MonetDB (as far as I can tell by quickly looking at the code).
What you get when you do SELECT * FROM t; where t contains a column of type geometry is the string representation of the internal (WKB) representation produced by the function GEOSGeomToWKT(). I.e., one conversion WKB->WKT.
If you do SELECT GeomFromText(g,0) FROM t; where g is a column of type geometry, it does a conversion WKB->WKT->WKB->WKT because an intermediate table is created with the result of GeomFromText. GeomFromText expects a string (varchar) and so an automatic WKB->WKT conversion takes place. GeomFromText itself does the WKT->WKB conversion, and you get an extra WKT->WKB conversion because the select produces a textual representation of the column.
> > On Wed, Apr 27, 2011 at 3:46 PM, Sjoerd Mullender <sjoerd@acm.org <mailto:sjoerd@acm.org> > <mailto:sjoerd@acm.org <mailto:sjoerd@acm.org>>> wrote: > > On 2011-04-27 14:37, Georgios Garmpis wrote: > > I have tried GeomFromText but it doesn't seem to return WKB. > > > > sql>SELECT GeomFromText('POINT(1 2)', 0); > > > +----------------------------------------------------------------------------+ > > | geomfromtext_single_value | > > +======================================+ > > | POINT (1.0000000000000000 2.0000000000000000) | > > > +----------------------------------------------------------------------------+ > > 1 tuple (0.325ms) > > Then what do you expect (or wish to get)? What would the WKB look like > at the SQL level? > > > > > > > On Wed, Apr 27, 2011 at 3:30 PM, Sjoerd Mullender <sjoerd@acm.org <mailto:sjoerd@acm.org> > <mailto:sjoerd@acm.org <mailto:sjoerd@acm.org>> > > <mailto:sjoerd@acm.org <mailto:sjoerd@acm.org> <mailto:sjoerd@acm.org <mailto:sjoerd@acm.org>>>> wrote: > > > > On 2011-04-27 11:30, Georgios Garmpis wrote: > > > In SQL > > > > > > I need something like that SELECT AsWKB('POINT(1, 2)'); > > > > What about this: > > SELECT GeomFromText('POINT(1 2)', 0); > > > > The string ('POINT(1 2)') should not have a comma in it, and > the extra > > argument (0) is ignored. > > > > > On Wed, Apr 27, 2011 at 12:09 PM, <Stefan.Manegold@cwi.nl <mailto:Stefan.Manegold@cwi.nl> > <mailto:Stefan.Manegold@cwi.nl <mailto:Stefan.Manegold@cwi.nl>> > > <mailto:Stefan.Manegold@cwi.nl <mailto:Stefan.Manegold@cwi.nl> <mailto:Stefan.Manegold@cwi.nl <mailto:Stefan.Manegold@cwi.nl>>> > > > <mailto:Stefan.Manegold@cwi.nl <mailto:Stefan.Manegold@cwi.nl> > <mailto:Stefan.Manegold@cwi.nl <mailto:Stefan.Manegold@cwi.nl>> <mailto:Stefan.Manegold@cwi.nl <mailto:Stefan.Manegold@cwi.nl> > <mailto:Stefan.Manegold@cwi.nl <mailto:Stefan.Manegold@cwi.nl>>>>> > > wrote: > > > > > > George, > > > > > > where do you need to get the Well Known Binary > representation of a > > > geometry? > > > As documentation? > > > In C? > > > In MAL? > > > In SQL? > > > > > > Stefan > > > > > > On Wed, Apr 27, 2011 at 11:50:53AM +0300, Georgios > Garmpis wrote: > > > > Hi, > > > > > > > > I need to get the Well Known Binary representation of a > > geometry but > > > > I didn't find any function in documentation to do this. > > > > Any ideas? > > > > > > > > -- > > > > George Garbis > > > > > > > > > > > > > ------------------------------------------------------------------------------ > > > > WhatsUp Gold - Download Free Network Management Software > > > > The most intuitive, comprehensive, and cost-effective > network > > > > management toolset available today. Delivers lowest > initial > > > > acquisition cost and overall TCO of any competing > solution. > > > > http://p.sf.net/sfu/whatsupgold-sd > > > > > > > _______________________________________________ > > > > MonetDB-users mailing list > > > > MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>> > > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>>> > > > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>> > > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>>>> > > > > https://lists.sourceforge.net/lists/listinfo/monetdb-users > > > > > > > > > -- > > > | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | > > > | http://CWI.nl/~manegold/ | Science Park 123 (L321) | > > > | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) | > > > > > > > > > ------------------------------------------------------------------------------ > > > WhatsUp Gold - Download Free Network Management Software > > > The most intuitive, comprehensive, and cost-effective > network > > > management toolset available today. Delivers lowest initial > > > acquisition cost and overall TCO of any competing solution. > > > http://p.sf.net/sfu/whatsupgold-sd > > > _______________________________________________ > > > MonetDB-users mailing list > > > MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>> > > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>>> > > > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>> > > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>>>> > > > https://lists.sourceforge.net/lists/listinfo/monetdb-users > > > > > > > > > > > > > > > -- > > > George Garbis > > > > > > > > > > > > > > > ------------------------------------------------------------------------------ > > > WhatsUp Gold - Download Free Network Management Software > > > The most intuitive, comprehensive, and cost-effective network > > > management toolset available today. Delivers lowest initial > > > acquisition cost and overall TCO of any competing solution. > > > http://p.sf.net/sfu/whatsupgold-sd > > > > > > > > > > > > _______________________________________________ > > > MonetDB-users mailing list > > > MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>> > > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>>> > > > https://lists.sourceforge.net/lists/listinfo/monetdb-users > > > > > > -- > > Sjoerd Mullender > > > > > > > ------------------------------------------------------------------------------ > > WhatsUp Gold - Download Free Network Management Software > > The most intuitive, comprehensive, and cost-effective network > > management toolset available today. Delivers lowest initial > > acquisition cost and overall TCO of any competing solution. > > http://p.sf.net/sfu/whatsupgold-sd > > _______________________________________________ > > MonetDB-users mailing list > > MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>> > > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>>> > > https://lists.sourceforge.net/lists/listinfo/monetdb-users > > > > > > > > > > -- > > George Garbis > > > > > > > > > ------------------------------------------------------------------------------ > > WhatsUp Gold - Download Free Network Management Software > > The most intuitive, comprehensive, and cost-effective network > > management toolset available today. Delivers lowest initial > > acquisition cost and overall TCO of any competing solution. > > http://p.sf.net/sfu/whatsupgold-sd > > > > > > > > _______________________________________________ > > MonetDB-users mailing list > > MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>> > > https://lists.sourceforge.net/lists/listinfo/monetdb-users > > > -- > Sjoerd Mullender > > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > _______________________________________________ > MonetDB-users mailing list > MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > <mailto:MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net>> > https://lists.sourceforge.net/lists/listinfo/monetdb-users > > > > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > > > > _______________________________________________ > MonetDB-users mailing list > MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Sjoerd Mullender
------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net <mailto:MonetDB-users@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- George Garbis
------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Sjoerd Mullender