Hi Luca, I follow your advice and now I have all my features. I had to do some union/collect to have the awaited result.
It's just sad that I can't take more advantage of GDAL to do this : do we know why my first method can't work ? Because of a limitation in ST_GeomFromText ? Because of a limitation in GDAL ? Should I used WKB instead of WKT to have the same result ? Regards, Alexandre Gacon 2011/6/13 Luca Sigfrido Percich <sigfr...@tiscali.it> > Hi Alexandre, > > if I well understood your problem, you're already doing half of the job > (the queries)in PostGIS, so why not doing everything using PostGIS > queries? > Moreover, I think you don't need union. > > Assuming towns is a polygon layer, try: > > select distinct t.* from > towns as t, > (select distinct * from towns where town_in_group_A_condition) as t2 > where t.fid = t2.fid or touches(t.geom, t2.geom); > > Let us know. > > All the best > > Sig > > > Il giorno lun, 13/06/2011 alle 09.52 +0200, Alexandre Gacon ha scritto: > > Hi, > > > > > > I need to do the following request to find some data: > > > > > > - I have a bunch of towns (let's call them group A) > > - I retrieve the towns touching the group A (let's call them group B) > > - I make the union of group A and group B > > - I ask the towns covered by the resulting union > > > > > > For the moment, I use GDAL to do the processing like that: > > > > > > - I use OGRGeometry::Union to make the union of group A towns > > - I send a request to a postgis database with a ST_Touches where > > clause and the group A geometry as WKT > > - I make the union of the resulting geometries with OGRGeometry::Union > > - I send a request to a postgis database with a ST_Covers where clause > > and the union of group A and group B as WKT > > > > > > My problem is that I don't retrieve all the towns I initially have to > > build my geometry. > > > > > > If I try to do the same request totally in pgsql (union, touches and > > covers), I have the awaited result. If I compare the area of the > > geometry of the ST_Covers where clause (between generation with GDAL > > and computation by postgis), I ha ve the same area. > > > > > > What could explain the difference in the result ? Precision loss in > > GDAL ? Precision loss because of the use of WKT ? Should I use WKB > > instead of WKT ? Should I do all my computations in postgis ? > > > > -- > > Alexandre Gacon > > > > _______________________________________________ > > gdal-dev mailing list > > gdal-dev@lists.osgeo.org > > http://lists.osgeo.org/mailman/listinfo/gdal-dev > > > _____________ > PRIVACY > Le informazioni contenute in questo messaggio sono riservate e > confidenziali. Il loro utilizzo e' consentito esclusivamente al destinatario > del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei > non fosse la persona a cui il presente messaggio è destinato, La invitiamo > ad eliminarlo dal Suo Sistema e a distruggere le varie copie o stampe, > dandone gentilmente comunicazione all’indirizzo mail del mittente. Ogni > utilizzo improprio e' contrario ai principi del D.lgs 196/03 e alla > legislazione europea (Direttiva 2002/58/CE). > > PRIVACY > Le informazioni contenute in questo messaggio sono riservate e > confidenziali. Il loro utilizzo e' consentito esclusivamente al destinatario > del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei > non fosse la persona a cui il presente messaggio è destinato, La invitiamo > ad eliminarlo dal Suo Sistema e a distruggere le varie copie o stampe, > dandone gentilmente comunicazione all’indirizzo mail del mittente. Ogni > utilizzo improprio e' contrario ai principi del D.lgs 196/03 e alla > legislazione europea (Direttiva 2002/58/CE). > -- Alexandre Gacon
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev