[postgis-users] Difference polygon sets

Espen Isaksen espen.isaksen at gmail.com
Mon Aug 30 01:27:32 PDT 2010


Ok, that was easy when you laid it out for me :-)

I guess I just got too caught up in using st_difference that I was
blinded for a while there.

Thanks Nicklas!

Ikke lasertakst, men satallitakst kan du vel kalle det :-)
(http://www.skogoglandskap.no/artikler/2009/nedlastingsinfo_satskog)

Espen



On Fri, Aug 27, 2010 at 5:12 PM, Nicklas Avén
<nicklas.aven at jordogskog.no> wrote:
> Hallo Espen
>
> ST_Difference cuts in the polygons to give the difference.
> It looks like your dissolved polygons contains one or more original
> polygons, not just parts of them.
>
> Then it is enough to find what original polygons is used in the
> dissolve.
>
> You can find those polygons with a query like this:
>
> SELECT a.*
> FROM original_data a LEFT JOIN dissolved_data b
>        ON ST_WITHIN(a.the_geom, b.the_geom)
> WHERE b.gid is null;
>
> I see you have no id or primary key in your dissolved dataset, so you
> can use any field in the where-part as long as you know it never has
> null as value.
> I would add an id field just to be sure.
>
> Är det data från lasertakst eller..?
> Bara nyfiken :-)
>
> HTH
> /Nicklas
>
>
>
>  On Fri, 2010-08-27 at 14:04 +0200, Espen Isaksen wrote:
>> Hi!
>>
>> I have a set of polygons where I have dissolved some of the polygons.
>> So I get two sets of polygons where one set is my original data, and
>> the other set is new polygons from the dissolve operations. Now I want
>> to extract the remaining polygons from my original dataset which were
>> not dissolved. I tried just a simple st_difference, but from what I
>> understand this operation does now work on sets of polygons.
>>
>> Both datasets can be found here in shape format:
>> http://dl.dropbox.com/u/8829/postgis.zip
>>
>> How can I extract only the remaining polygons from the original
>> dataset. I had a look at this
>> post(http://www.postgis.org/pipermail/postgis-users/2008-May/019511.html)
>> in the mailing list, but I did not succeed in changing it to fit my
>> purpose.
>>
>> Can anybody help me out?
>>
>> Kind regards,
>> Espen Isaksen
>> _______________________________________________
>> 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
>



More information about the postgis-users mailing list