[postgis-users] ESRI Shapes from database

Lee Keel lee.keel at uai.com
Thu Oct 18 08:46:59 PDT 2007


  _____  

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Obe,
Regina
Sent: Thursday, October 18, 2007 9:16 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] ESRI Shapes from database

 

Lee,

 

Okay now I think I understand the problem more clearly.  I guess I should
have earlier from your description.  Sadly I think you do have to do the
memcpy approach in C or similar thing in PLPerl or PLJava and then bind that
as a function. Unfortunately I know nothing about that stuff.

 

I think PLPerl ,PLJava, PLPython would be a little easier (granted slower)
since you can write the code directly in Postgresql.  Then write something
like this

http://www.captain.at/howto-java-convert-binary-data.php
<http://www.captain.at/howto-java-convert-binary-data.php>  but I'm not sure
if you would be allowed rights to create a new language on your PostgreSQL
server.

 

The problem is that the encode and decode functions are simply doing base
math between the two representations where as your bytea is storing the
physical bytes that define the double - precision (and the double precision
struct is not a straightforward byte to byte translation).  To implement
this in PostgreSQL without direct access to the memory of the double
precision - I suspect you'd have to get deep into bitwise math to do some
pretty hairy stuff  like described below for the double-precision 64 bit
which even if you get it right would be pretty slow if done in Pg. (e.g.
first bit for sign, next 11 bits for exponent, last 52 for fraction)

 

http://en.wikipedia.org/wiki/IEEE_floating-point_standard
<http://en.wikipedia.org/wiki/IEEE_floating-point_standard>  

 

 

As far as your C# stuff goes,  you said you used StringBuilder, have you
tried using StringWriter?  I haven't myself so I'm speaking from a lofty
level of ignorance.  I know StringWriter writes to a StringBuilder so would
seem more round about, but I wonder if it would get around your memory
problem since I think it behaves more like an IO Stream so maybe it writes
to a stringbuilder at the end.

 

Sorry I wasn't more helpful,

Regina

 

 

 

  _____  

[Lee Keel] 

Regina,

 

You have been a tremendous help.  I really appreciate all the extra time you
have taken.  I am trying a few other approaches at this time.  I did figure
out a workaround to my C# bug, but it is still WAY to slow.  I am now trying
to use the COPY command and see if that will work for me.

 

Thanks again for all of your time!

Lee Keel

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20071018/89e55208/attachment.html>


More information about the postgis-users mailing list