Create a "dissolved view" of a polygon layer?

362
2
Jump to solution
12-03-2021 11:02 AM
JayJohnsonWashoeCounty
Regular Contributor

Is it possible to create a SQL View of a feature layer that is essentially an "on the fly" dissolve?  

I have a polygon layer of fire response districts in which many small polygons are all the responsibility of a single station.  Rather than creating a derivative layer (which I then have to maintain) by dissolving on the "station" attribute, it would be great to have a view of this layer in which each unique "station" value has only a single multi-part polygon.  I'm not sure whether this is something that can be done with a view...

Thanks.

Jay
Washoe County GIS
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Honored Contributor

The answer is "it depends". Specifically, it depends upon the database platform you're using, but in general, this sort of thing is certainly possible. We use PostgreSQL with PostGIS, for example, and what you're describing can be accomplished simply with:

SELECT category_field,
    ST_Union(f.geom) as singlegeom
FROM sometable f
GROUP BY category_field

ST_Union handles the dissolve, while my GROUP BY field(s) will determine what the dissolve is based on.

I'd suggest checking your database platform's spatial function documentation and testing a few things out. When you're working with spatial functions in a view, you can very easily get into CPU and memory-intensive queries.

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
2 Replies
jcarlson
MVP Honored Contributor

The answer is "it depends". Specifically, it depends upon the database platform you're using, but in general, this sort of thing is certainly possible. We use PostgreSQL with PostGIS, for example, and what you're describing can be accomplished simply with:

SELECT category_field,
    ST_Union(f.geom) as singlegeom
FROM sometable f
GROUP BY category_field

ST_Union handles the dissolve, while my GROUP BY field(s) will determine what the dissolve is based on.

I'd suggest checking your database platform's spatial function documentation and testing a few things out. When you're working with spatial functions in a view, you can very easily get into CPU and memory-intensive queries.

- Josh Carlson
Kendall County GIS
0 Kudos
SergeyTolstov
Esri Contributor

If this is needed for the visualization purposes then you probably could achieve a "dissolved" look by selection of a proper symbol. Make a symbol that has the fill layer first and the stroke second. Then enable the Symbol Level Drawing. This will ensure that the internal outlines are hidden by the fill.

0 Kudos