On Thu, Sep 6, 2012 at 3:30 AM, Sina <sina.masoud.ans...@gmail.com> wrote:
> Hi all,
>
> I've just started using PostGIS as a datastore, importing shapefiles using
> shp2pgsql. I've attached the shapefiles I use to reproduce this issue:
> http://osgeo-org.1560.n6.nabble.com/file/n5000060/example.zip example.zip
>
That's interesting, if I ask for the geometry using asText(the_geom) I get:
LINEARRING (278290.62254 3278993.58112, 0 278289.93728, 21.398490000000038
0, 3278993.55365 21.3888800000002, 278288.00819 3278993.47131, 0
278287.18848, 21.317230000000336 0, 3278993.50351 21.308770000000322,
278285.4832 3278993.53053, 0 278284.55692, 21.260040000000117 0,
3278993.40385 21.258689999999888, 278283.9729 3278993.77125, 0
278284.07588, 21.312120000000277 0, 3278995.37423 21.511720000000196,
278284.0481 3278996.23131, 0 278284.04193, 21.624209999999948 0,
3278997.88273 21.682940000000144, 278284.1008 3278998.46505, 0
278284.08454, 21.781760000000304 0, 3278999.65585 21.92224000000033,
278284.06485 3279000.20076, 0 278283.98629, 22.127190000000155 0,
3279001.70609 22.145369999999957, 278283.95365 3279002.25773, 0 278284.042,
21.998679999999922 0, 3279003.72984 21.869190000000117, 278284.00034
3279004.37914, 0 278283.90341, 21.74765000000002 0, 3279004.45831
21.78599000000031, 278284.20201 3279004.16319, 0 278284.57093,
21.799630000000207 0, 3279003.07202 21.803319999999985, 278285.5789
3279002.56473, 0 278285.9973, 21.75789000000009 0, 3279001.21047
21.717100000000073, 278286.79038 3279000.72706, 0 278287.10914,
21.61284999999998 0, 3278999.77173 21.570719999999937)
However what GeoServer gets back from PostGIS is instead:
LINEARRING (278290.62254 3278993.58112, 0 278289.93728, 21.398490000000038
0, 3278993.55365 21.3888800000002, 278288.00819 3278993.47131, 0
278287.18848, 21.317230000000336 0, 3278993.50351 21.308770000000322,
278285.4832 3278993.53053, 0 278284.55692, 21.260040000000117 0,
3278993.40385 21.258689999999888, 278283.9729 3278993.77125, 0
278284.07588, 21.312120000000277 0, 3278995.37423 21.511720000000196,
278284.0481 3278996.23131, 0 278284.04193, 21.624209999999948 0,
3278997.88273 21.682940000000144, 278284.1008 3278998.46505, 0
278284.08454, 21.781760000000304 0, 3278999.65585 21.92224000000033,
278284.06485 3279000.20076, 0 278283.98629, 22.127190000000155 0,
3279001.70609 22.145369999999957, 278283.95365 3279002.25773, 0 278284.042,
21.998679999999922 0, 3279003.72984 21.869190000000117, 278284.00034
3279004.37914, 0 278283.90341, 21.74765000000002 0, 3279004.45831
21.78599000000031, 278284.20201 3279004.16319, 0 278284.57093,
21.799630000000207 0, 3279003.07202 21.803319999999985, 278285.5789
3279002.56473, 0 278285.9973, 21.75789000000009 0, 3279001.21047
21.717100000000073, 278286.79038 3279000.72706, 0 278287.10914,
21.61284999999998 0, 3278999.77173 21.570719999999937)
It seems there is some sort of coordinate shift. When looking at the table
definition in Postgresql I see:
"enforce_dims_the_geom" CHECK (st_ndims(the_geom) = 4)
So it seems the original geometry is 4 dimensional (XYZM?).
Looking into the JTS WKB reader it seems this possibility is not taken into
account, which might account for all those zero's
around in the coordinate list, the Z is read (but not printed in WKT), and
the M is unepected and probably taken for the
X of the next coordinate, and so on, causing a shift into how geometries
are read
CC'ing Martin Davis, the creator of JTS, Martin, what do you think?
For the record, the query we're using to hit PostgreSQL is:
SELECT
"gid","area","area_code_","area_id","perimeter",encode(ST_AsEWKB("the_geom"),'base64')
as "the_geom" FROM "public"."desert" LIMIT 50
Maybe in this case the WKB returned by postrgresql is extended beyond JTS
ability to read it.
Am I remembering it wrong, of if we just ask for WKB we will shave off the
Z values as well?
Cheers
Andrea
--
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users