Closed GoogleCodeExporter closed 8 years ago
I'm thinking it's because of this segment:
//Modify WKB Geometry type
var intGeometryType = (uint)geometryType & 0xff;
if ((HandleOrdinates & Ordinates.Z) == Ordinates.Z)
{
intGeometryType += 1000;
intGeometryType |= 0x80000000;
}
I haven't seen anything about the |= in any of my google searches on WKB.
Original comment by kjeremy@gmail.com
on 14 Dec 2012 at 1:24
You are aware that there are special SpatiaLite reader/writer classes?
The flag 0x80000000 is from the EWKB definition used within PostGIS.
Need to check.
Original comment by felix.ob...@netcologne.de
on 14 Dec 2012 at 12:11
Addendum:
> WKBWriter writer = new WKBWriter(ByteOrder.LittleEndian, false, true, false);
> IPoint pt = new Point(1, 1, 1);
> byte[] wkb = writer.Write(pt); // It's a shame I have to do this.
Why not use
var wkb = new Point(1, 1, 1).AsBinary() /*.ToBinary()*/;
If that is not suitable, you can write yourself some extension method like
public static byte[] AsBinary(this IGeometry self, IBinaryWriter<?> writer)
{
return writer.Write(self);
}
One more question:
Have you tried SpatiaLite's wkb parsing functions? Do they fail?
Original comment by felix.ob...@netcologne.de
on 14 Dec 2012 at 12:28
Hi Felix,
In order for the WKB to capture the Z value I can't use AsBinary directly... I
have to pass in true for emitZ to the WKBWriter. Otherwise the geometry type
is represented as 1 instead of 1001 in the WKB.
Spatialite fails to parse the output of that unless I zero out byte[4]. If I
call AsBinary() and try to insert into the database it fails because my
geometry needs to be XYZ in my database. AsBinary() works fine for inserting
XY points. As soon as I need to deal with XYZ it fails.
There are special SpatiaLite readers/writers in NetTopologySuite? If
WKBWriter/Reader are for EWKB why are they not EWKBWriter/Reader?
Original comment by kjeremy@gmail.com
on 14 Dec 2012 at 2:45
The Writer doesn't appear to be in the 1.12.1 tarball.
Original comment by kjeremy@gmail.com
on 14 Dec 2012 at 2:54
Ok I see the issue with not being able to find the writer. It's not in
NetTopologySuite.Net.VS2010.sln but appears to be in
NetTopologySuite.VS2010.sln which was not what I had built because I lack
Silverlight etc. Can I just copy those projects into the other solution and
build?
Original comment by kjeremy@gmail.com
on 14 Dec 2012 at 3:05
Their only (non-Framework) reference is to GeoAPI (iirc), so you should be able
to do that.
Original comment by felix.ob...@netcologne.de
on 14 Dec 2012 at 3:09
Thank you! I added the project to the MonoDroid solution and it worked so I'll
close the issue out. I do think the WKB classes should be renamed to EWKB
though.
Original comment by kjeremy@gmail.com
on 14 Dec 2012 at 7:12
@kjeremy:
Could you please test if fixing WKBWriter with attached patchfile solves the
issue.
Thanks
Original comment by felix.ob...@netcologne.de
on 19 Dec 2012 at 11:24
Attachments:
Patch applied some time ago, no more complaints, seems to work
Original comment by felix.ob...@netcologne.de
on 24 Jun 2013 at 11:51
Original issue reported on code.google.com by
kjeremy@gmail.com
on 14 Dec 2012 at 12:37