[mapserver-users] Impact of InValid Geometry on PostGIS queries

Benoît Andrieu bea at ixsea.com
Thu Dec 18 04:24:53 EST 2008


Hi Ben,

Option A : from my own very little experience with postgis & mapserver, 
you'll have a little loss of performance.
Option B : in the worst case, you'll get an error and mapserver will throw 
an exception to the client.
Option C : poor guy... :)
Option D : you should maybe try to put a call to buffer around your geom 
column; in some cases, it is able to do some magic results !

-- To see if the magic happens
select buffer(the_geom), IsValid(buffer(the_geom)) from gis_roads where 
IsValid(the_geom) = false;

-- To select and do the magic without updates
select the_geom, count(gid) from (select buffer(the_geom) as the_geom, gid 
from gis_roads) group by the_geom;

-- To update magically
update gis_roads
set the_geom = buffer(the_geom)
where IsValid(the_geom) == false;

I did not test those, so maybe it won't work...

Best regards,

Benoît


Benoît Andrieu
+33.(0)1.30.08.95.21
bea at ixsea.com
benoit.andrieu at gmail.com

----- Original Message ----- 
From: "Ben Madin" <ben at remoteinformation.com.au>
To: <mapserver-users at lists.osgeo.org>
Sent: Thursday, December 18, 2008 8:07 AM
Subject: [mapserver-users] Impact of InValid Geometry on PostGIS queries


> G'day all,
>
> I have a roads shapefile which I imported in PostGIS, planning to  merge 
> several different countries data eventually. It is producing a  layer on 
> the map, and labels etc.
>
> However, the data isn't all good - in fact, about 10% is bad :
>
> es=# select IsValid(the_geom), count(gid) from gis_roads group by 
> IsValid(the_geom);
>
>  isvalid | count
> ----------+-------
>               |  4128
>       t       | 39670
> (2 rows)
>
> My question then is :
>
> should I ?
>
> a) leave it - it won't do any harm, but probably won't be rendered,
> b) remove it - it may be incorrectly rendered, or waste processor time  on 
> data that is unuseable,
> c) fix it by hand (lazy git!)
> d) fix it automatically, using super program I wasn't aware of.  (called?)
>
> actually, I don't have the time or budget for option c, and I suspect 
> option d does not exist!
>
> cheers
>
> Ben
>
>
>
> -- 
>
> Ben Madin
> REMOTE INFORMATION
>
> t : +61 8 9192 5455
> f : +61 8 9192 5535
> m : 0448 887 220
> Broome   WA   6725
>
> ben at remoteinformation.com.au
>
>
>
> Out here, it pays to know...
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users 



More information about the mapserver-users mailing list