This project has moved and is read-only. For the latest updates, please go here.

Postgis 2.0

Topics: Data Access, SharpMap v0.9 / v1.x
Jun 14, 2012 at 3:43 AM

- Today, I upgrate to postgis 2.0 ( postgres 9.1 newest released ). There are some dedicated functions: Astext, AsBinary, SetSrid,... . We only need run share\contrib\postgis-2.0/legacy.sql scripts  in order to use dedicated functions.

- The second problem in postgis data provider is AsBinary(geom) funtion. I debuged to get a MultiLineString with database in UTF8 format.

Sql: select geom, Asbinary(geom) as sharpmap_tempgeometry from lineStringLayer in PGAdmin3:

geom: "0105000020E610000001000000010200000007000000CDED953D0AAD5A40FC7E6923E2862540C54E18E606AD5A403C3136BCEC862540040040BB00AD5A407A606A82138725400F000095EEAC5A40EDCAD2317D872540E7FFFF5CEAAC5A40DA45DFC99787254029BA5EE9E6AC5A404A951BABAF87254029BA8682E5AC5A40BB34B45DB9872540"

sharpmap_tempgeometry: "\001\005\000\000\000\001\000\000\000\001\002\000\000\000\007\000\000\000\315\355\225=\012\255Z@\374~i#\342\206%@\305N\030\346\006\255Z@<16\274\354\206%@\004\000@\273\000\255Z@z`j\202\023\207%@\017\000\000\225\356\254Z@\355\312\3221}\207%@\347\377\377\\\352\254Z@\332E\337\311\227\207%@)\272^\351\346\254Z@J\225\033\253\257\207%@)\272\206\202\345\254Z@\2734\264]\271\207%@"

When I convert  sharpmap_tempgeometry to byte[] on C# . I get byte[] array follow:

92, 48, 48,..........

instead of:

01, 05,........

B/c: Function SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse can not get byte_order and GeometryType of WKB.

How to get the correct byte on C#?




Jun 14, 2012 at 4:44 AM

I use old Npgsql version. Use higher version of Npgsql than 2.0.10 ( like in trunk) . Bug is fixed


Jun 14, 2012 at 7:59 AM

Nonetheless we should be fixing the calls.

I think all we need to do is add the st_ to the AsBinary, AsText and SetSRID functions.
These should work for PostGis 1.5.x as well.

Jun 14, 2012 at 8:03 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.