[postgis-users] valid MULTIPOLYGONs and order of vertices?
strk at refractions.net
strk at refractions.net
Tue Apr 26 06:49:27 PDT 2005
On Tue, Apr 26, 2005 at 03:42:45PM +0200, Hubert Fröhlich wrote:
> >You can use simplify(geom, 0) as a mean to remove useless vertexes
> >(in [0 0, 0 5, 0 10] 0 5 is useless)
> thanks!
>
> >
> >I haven't read the specs about OGC validity of the shapes,
> >anyway JTS gives the same valid result (postgis/jts is a killer
> >GEOS debugger!!).
>
>
> I think that shape is only "near" OGC SFS, but the "standard" (i.e. it
> is a de-facto standard, "commonly used") was developed by ESRI and
> the last update was 1998 . The current SFS came out in 1999 . Some
> concepts are the same, but in detail - hmmm, I read
> http://archives.postgresql.org/pgsql-general/2002-10/msg00561.php (page 8)
>
> "Because this specification does not forbid consecutive points with
> identical coordinates, shapefile readers must handle such cases. On the
> other hand, the degenerate, zero length or zero area parts that might
> result are not allowed." According to this, the Postgis way of Shape
> should be OK and my statement (see below: " does not conform to the
> specs") is somewhat wrong. However, we have customers who claim that
> some ESRI products report this behavior as an error.
>
> So, the dilemma of the quasi-standard
> * A correct Shape is what is defined by the specs (or is it just a
> white paper?)
> vs.
> * A correct Shape is (more or less) what can be treated by ESRI
> software without errors
>
> will remain forever...
We actually don't care about being standard, if not because it allows
ease of interoperability. For this specific case what matters is that
pgsql2shp produces "working" shapefiles. A solution could be
implementing a stored procedure for specifically this kind of cleanup:
makeShapeValid(geometry). This would allow us to initially just
implement duplicated vertex removal, and incrementally add any new
"discovered" pickiness of Shapefile format.
What people think about this ?
--strk;
>
> Greetings,
> Hubert
>
> >
> >--strk;
> >
> >On Tue, Apr 26, 2005 at 01:13:22PM +0200, Hubert Fröhlich wrote:
> >
> >>Hi list,
> >>I am using Postgres 8.0.0, Postgis 1.0.0 RC1 and geos 2.1.1 under SuSE
> >>Linux 9.2.
> >>
> >>
> >>Say I have a polygon like
> >>
> >>
> >>
> >>select isValid('MULTIPOLYGON(((4457484.31 5403325.86, 4457473.8
> >>5403324.77, 4457473.29 5403329.76, 4457472.55 5403330.04, 4457471.9
> >>5403330.68, 4457471.64 5403331.45, 4457471.26 5403335.14, 4457471.42
> >>5403335.87, 4457471.88 5403336.47, 4457472.53 5403336.79, 4457472.08
> >>5403341.31, 4457472.04 5403341.71, 4457472.03 5403341.83, 4457513.210
> >>5403346.130, 4457513.219 5403346.129, 4457513.266 5403346.120,
> >>4457513.314 5403346.109, 4457513.360 5403346.096, 4457513.406
> >>5403346.081, 4457513.452 5403346.063, 4457513.496 5403346.044,
> >>4457513.539 5403346.022, 4457513.582 5403345.998, 4457513.623
> >>5403345.973, 4457513.663 5403345.945, 4457513.670 5403345.940,
> >>4457513.680 5403345.933, 4457513.718 5403345.903, 4457513.754
> >>5403345.871, 4457513.789 5403345.837, 4457513.823 5403345.802,
> >>4457513.854 5403345.765, 4457513.884 5403345.727, 4457513.912
> >>5403345.687, 4457513.938 5403345.646, 4457513.963 5403345.604,
> >>4457513.985 5403345.561, 4457513.99 5403345.55, 4457514.61 5403339.69,
> >>4457515.27 5403339.78, 4457515.76 5403335.67, 4457515.04 5403335.56,
> >>4457515.660 5403329.770, 4457515.660 5403329.769, 4457515.643
> >>5403329.718, 4457515.624 5403329.668, 4457515.602 5403329.619,
> >>4457515.578 5403329.571, 4457515.552 5403329.524, 4457515.524
> >>5403329.478, 4457515.494 5403329.434, 4457515.461 5403329.391,
> >>4457515.427 5403329.350,
> >><i mean this>
> >>4457515.390 5403329.310, 4457515.390 5403329.310,
> >></i mean this>
> >>4457515.378 5403329.298, 4457515.339 5403329.261, 4457515.299
> >>5403329.225, 4457515.257 5403329.192, 4457515.213 5403329.161,
> >>4457515.168 5403329.131, 4457515.122 5403329.104, 4457515.074
> >>5403329.079, 4457515.026 5403329.057, 4457515.01 5403329.05, 4457514.91
> >>5403329.03, 4457507.42 5403328.25, 4457484.31 5403325.86)))' );
> >>isvalid
> >>---------
> >>t
> >>
> >>
> >>Postgis will check it as valid despite it has two identic points
> >>following each other.
> >>
> >>a) Is this correct?
> >>b) When I produce a shape from this with pgsql2shp, both points are
> >>written to a shape, producing a shape that does not conform to the specs.
> >>c) How to avoid that? I.e. is there a way to suppress subsequent
> >>identical points?
> >>--
> >>Mit freundlichen Grüßen / With kind regards
> >>
> >>Hubert Fröhlich
> >>
> >>-------------------------------------------------------------------------------
> >>Dr.-Ing. Hubert Fröhlich
> >>Bezirksfinanzdirektion München
> >>Alexandrastr. 3, D-80538 München, GERMANY
> >>Tel. :+49 (0)89 / 2190 - 2980
> >>Fax :+49 (0)89 / 2190 - 2997
> >>hubert dot froehlich at bvv dot bayern dot de
> >>_______________________________________________
> >>postgis-users mailing list
> >>postgis-users at postgis.refractions.net
> >>http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >_______________________________________________
> >postgis-users mailing list
> >postgis-users at postgis.refractions.net
> >http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> --
> Mit freundlichen Grüßen / With kind regards
>
> Hubert Fröhlich
>
> -------------------------------------------------------------------------------
> Dr.-Ing. Hubert Fröhlich
> Bezirksfinanzdirektion München
> Alexandrastr. 3, D-80538 München, GERMANY
> Tel. :+49 (0)89 / 2190 - 2980
> Fax :+49 (0)89 / 2190 - 2997
> hubert dot froehlich at bvv dot bayern dot de
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list