[postgis-tickets] [PostGIS] #2181: ST_Buffer returning multipolygon with linestring input
PostGIS
trac at osgeo.org
Sat Jan 19 02:49:48 PST 2013
#2181: ST_Buffer returning multipolygon with linestring input
----------------------------------------------+-----------------------------
Reporter: mcastrog | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 1.5.9
Component: postgis | Version: 1.5.X
Keywords: Buffer, linestring, multipolygon |
----------------------------------------------+-----------------------------
Hi,
I got the standard North Carolina dataset
http://grass.osgeo.org/sampledata/north_carolina/nc_shape.tar.gz and
imported ''streams'' shape layer into postgresql through shp2psql shell
command.[[BR]]
In the resulting table the geometry field contains only LINESTRING
elements.
By running the following query:
{{{
SELECT
sub.gid, GeometryType(sub.buffer) AS buffer_GeometryType,
GeometryType(sub.the_geom) AS stream_GeometryType
FROM (
SELECT gid, the_geom, st_buffer (the_geom, 100) AS buffer
FROM streams
) AS sub
WHERE
GeometryType(sub.buffer) <> 'POLYGON';
}}}
I get this output:
{{{
gid | buffer_geometrytype | stream_geometrytype
------+---------------------+---------------------
674 | MULTIPOLYGON | LINESTRING
810 | MULTIPOLYGON | LINESTRING
811 | MULTIPOLYGON | LINESTRING
1564 | MULTIPOLYGON | LINESTRING
1571 | MULTIPOLYGON | LINESTRING
1667 | MULTIPOLYGON | LINESTRING
2764 | MULTIPOLYGON | LINESTRING
2848 | MULTIPOLYGON | LINESTRING
5203 | MULTIPOLYGON | LINESTRING
5250 | MULTIPOLYGON | LINESTRING
8369 | MULTIPOLYGON | LINESTRING
}}}
So, 11 out of 8554 records are MULTIPOLYGONs not POLYGONs as expected.
To be more accurate, I isolated the record having gid=674
{{{
SELECT gid, AsText(the_geom)
FROM streams
WHERE gid=674;
}}}
the related output is:
{{{
674 | LINESTRING(640770.332537465 216785.425146015,640770.356311913
216785.560172686,640770.475488952 216786.226162019,640770.647396495
216787.800152365,640770.658978918 216789.268376902,640770.447752096
216792.399898366,640769.98018796 216795.624688816,640769.110287021
216798.527305023,640767.648768098 216801.891389348,640766.02448565
216804.805892778,640764.74005588 216807.134569434,640763.337363474
216809.560477487,640761.650901703 216812.246990061,640759.955600712
216815.327305019,640758.482499366 216817.868732504,640757.383693167
216819.548488661,640756.238862077 216821.226720821,640754.01503683
216824.434442434,640751.366929134 216828.435255234,640749.204368809
216832.450088865,640747.25516891 216836.227787618,640746.014020829
216838.801219168,640745.393751588 216840.360274284,640744.315976633
216842.854457673,640743.400050801 216844.65704848,640742.582575565
216846.277673322,640741.52491745 216848.478638524,640740.503835408
216850.705816576,640739.787553975 216852.270967708,640739.053289307
216853.851968469,640738.173025147 216855.546355058,640737.55488951
216856.568961104,640736.817272035 216857.822910812,640735.910795021
216859.35697228,640734.77510795 216861.236982439,640733.832969266
216862.938074642,640732.814325629 216865.039674844,640731.225095251
216869.012141189,640729.979984761 216871.879095724,640729.445974092
216873.02148841,640729.002794006 216873.679857725,640728.952197105
216873.745389857,640728.676962154 216874.089814544)
}}}
All of you can see that the above record represents a regular LINESTRING
geometry.
Finally I exported the gid=674 stream and the related buffer, you can see
large and small zoom at this links:
https://docs.google.com/file/d/0B0MkYF-Ljs34c1owdkc1U0Q4OFk/edit
https://docs.google.com/file/d/0B0MkYF-Ljs34MlNkTkJwc0dEbG8/edit
The behaviour is not regular, I suppose.
About postis version
{{{
SELECT postgis_full_version();
}}}
returns
POSTGIS="1.5.2" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1, 23 September
2009" LIBXML="2.7.8" USE_STAT
Best wishes.[[BR]]
Marco
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/2181>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list