Hi Luca,<div><br></div><div>I follow your advice and now I have all my features. I had to do some union/collect to have the awaited result.</div><div><br></div><div>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 ?</div>
<div><br></div><div>Regards,</div><div><br></div><div>Alexandre Gacon<br><br><div class="gmail_quote">2011/6/13 Luca Sigfrido Percich <span dir="ltr"><<a href="mailto:sigfrido@tiscali.it">sigfrido@tiscali.it</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Alexandre,<br>
<br>
if I well understood your problem, you're already doing half of the job<br>
(the queries)in PostGIS, so why not doing everything using PostGIS<br>
queries?<br>
Moreover, I think you don't need union.<br>
<br>
Assuming towns is a polygon layer, try:<br>
<br>
select distinct t.* from<br>
towns as t,<br>
(select distinct * from towns where town_in_group_A_condition) as t2<br>
where t.fid = t2.fid or touches(t.geom, t2.geom);<br>
<br>
Let us know.<br>
<br>
All the best<br>
<br>
Sig<br>
<br>
<br>
Il giorno lun, 13/06/2011 alle 09.52 +0200, Alexandre Gacon ha scritto:<br>
<div><div></div><div class="h5">> Hi,<br>
><br>
><br>
> I need to do the following request to find some data:<br>
><br>
><br>
> - I have a bunch of towns (let's call them group A)<br>
> - I retrieve the towns touching the group A (let's call them group B)<br>
> - I make the union of group A and group B<br>
> - I ask the towns covered by the resulting union<br>
><br>
><br>
> For the moment, I use GDAL to do the processing like that:<br>
><br>
><br>
> - I use OGRGeometry::Union to make the union of group A towns<br>
> - I send a request to a postgis database with a ST_Touches where<br>
> clause and the group A geometry as WKT<br>
> - I make the union of the resulting geometries with OGRGeometry::Union<br>
> - I send a request to a postgis database with a ST_Covers where clause<br>
> and the union of group A and group B as WKT<br>
><br>
><br>
> My problem is that I don't retrieve all the towns I initially have to<br>
> build my geometry.<br>
><br>
><br>
> If I try to do the same request totally in pgsql (union, touches and<br>
> covers), I have the awaited result. If I compare the area of the<br>
> geometry of the ST_Covers where clause (between generation with GDAL<br>
> and computation by postgis), I ha ve the same area.<br>
><br>
><br>
> What could explain the difference in the result ? Precision loss in<br>
> GDAL ? Precision loss because of the use of WKT ? Should I use WKB<br>
> instead of WKT ? Should I do all my computations in postgis ?<br>
><br>
> --<br>
> Alexandre Gacon<br>
><br>
</div></div>> _______________________________________________<br>
> gdal-dev mailing list<br>
> <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
<br>
_____________<br>
PRIVACY<br>
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).<br>
<br>
PRIVACY<br>
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).<br>
</blockquote></div><br><br clear="all"><br>-- <br>Alexandre Gacon<br>
</div>