[gdal-dev] PostGIS does not close a ring created by ogr2ogr
jukka.rahkonen at mmmtike.fi
Mon Sep 8 05:24:02 PDT 2014
Anybody interested in biting some bytes of WKB? Thorough description of the
trouble is in Stackexchange
User has converted a linestring from dxf format into PostGIS with ogr2ogr.
By staring at the WKB the linestring seems to make a closing ring with first
and last vertex having exactly same coordinates which are in binary:
However, PostGIS claims that the ring is not closed and it can't make a
polygon with ST_MakePolygon. ST_MakePolygon is successful if WKB is first
converted into WKT and then back to WKB with PostGIS. There are some
differences in the beginning of WKB created by ogr2ogr and PostGIS. GDAL
writes this before the coordinates begin (separates with dashes from where I
believe to be logical breaks)
PostGIS version writes different geometry type and WKB is a few bytes shorter:
So GDAL writes "02000020" instead of "02000000" but it also writes bytes
"B46B0000" which do not have any equivalent it the PostGIS WKB. After these
bytes WKB seems to be identical.
I am curious to get an explanation for what happens.
More information about the gdal-dev