Hi,

Thanks Larry, I think your patch will be much appreciated.
I had a look and did not notice anything wrong. I also checked you have 
used an uptodate svn version.
I'll have good opportunities to make more tests after your commit and 
before next release as I often use this plugin.

Thanks again

Michaël


Le 30/03/2011 14:34, edgar.sol...@web.de a écrit :
> looks sensible to me. please suit yourself. i just added your lreeder sf.net 
> account to the svn. if anybody does not agree to give larry svn acces, please 
> speak up now.
>
> @larry&  all: could somebody please also verify the nightly build for the 
> correctness of that change?
>
> thanks alot... ede
>
>
> On 30.03.2011 06:19, Larry Reeder 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
>> 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

Reply via email to