Hi,
Good question Etienne,
If I remember correctly, the plugin reads the first geometry column
declared in the select statement as the geometry and next ones as simple
binary data.
Needs to be confirmed from the code or checked if you have an
opportunity to do it :
- select geom1, geom2 from table
- select geom2, geom1 from table
Michaël
Le 30/03/2011 14:33, Etienne Bellemare a écrit :
Wow ! That's going to be useful. How does it handle two geom fields ?
Etienne
On Wed, Mar 30, 2011 at 12:19 AM, Larry Reeder <lnree...@gmail.com
<mailto:lnree...@gmail.com>> wrote:
I've got a patch that allows direct selection of a PostGis geometry
column without needing to use ST_AsBinary() to get past that "unknown
WKB type 48" error. The patch also supports continued use of
ST_AsBinary. Can someone commit the patch for me or give me write
access to the repository?
Thanks............. lreeder
Patch below:
Index: datastore/postgis/PostgisValueConverterFactory.java
===================================================================
--- datastore/postgis/PostgisValueConverterFactory.java (revision
2241)
+++ datastore/postgis/PostgisValueConverterFactory.java (working copy)
@@ -69,8 +69,36 @@
throws IOException, SQLException, ParseException
{
byte[] bytes = rs.getBytes(columnIndex);
- if (bytes == null) return
wktReader.read("GEOMETRYCOLLECTION EMPTY");
- else return wkbReader.read(bytes);
+
+ //so rs.getBytes will be one of two things:
+ //1. The actual bytes of the WKB if someone did ST_AsBinary
+ //2. The bytes of hex representation of the WKB.
+
+ //in the case of #1, according to the WKB spec, the byte value
+ //can only be 0 or 1.
+ //in the case of #2, it's a hex string, so values range
from ascii 0-F
+ //use this logic to determine how to process the bytes.
+
+ Geometry geometry = null;
+ if(bytes == null || bytes.length <= 0)
+ {
+ geometry = wktReader.read("GEOMETRYCOLLECTION EMPTY");
+ }
+ else
+ {
+ //assume it's the actual bytes (from ST_AsBinary)
+ byte[] realWkbBytes = bytes;
+ if(bytes[0] >= '0')
+ {
+ //ok, it's hex, convert hex string to actual bytes
+ String hexString = new String(bytes);
+ realWkbBytes = WKBReader.hexToBytes(hexString);
+ }
+
+ geometry = wkbReader.read(realWkbBytes);
+ }
+
+ return geometry;
}
}
}
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to
meet the
growing manageability and security demands of your customers.
Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your
software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
<mailto:Jump-pilot-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel