[postgis-users] How to deal with linestring that is not simple (OGC compliant)

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Fri Aug 14 03:04:31 PDT 2009

Pavla Novakova wrote:

> Hi,
> I'm very new to both GIS and PostGIS spatial database. I've started read
> PostGIS manual (1.4) and on chapter 4.2.5 found:  "As such, many PostGIS
> methods require, or more accurately, assume that geometries that are
> operated on are both simple and valid."
> This has broken my idea how to represent GPS track in PostGIS database: I
> thought about to save GPS track as linestring created from trackpoints, but
> this may generally lead to non-simple linestring.  My next thought was to
> split the non-simple linestring to multiple simple linestrings and this 
> is where
> I need your help. Is PostGIS capable to do it for me? If not, what tool
> (best using java) can I use to split complex linestring to OGC compliant
> multiple simple linestrings please?
> Thank you very much for any help.
> Pavla Novakova

Hi Pavla,

It depends on what analysis you are trying to do. It's generally only 
the GEOS functions which require simple and valid input to work 
correctly - most of the native PostGIS functions are reasonably robust. 
Have a look at the PostGIS manual to determine whether you need to use 
GEOS functions or not, and then try a few experiments on some test data 
so that you can verify the results.



Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs

More information about the postgis-users mailing list