Skip to main content
embedded image, trimmed obsolete text
Source Link

Totally brand new at using PostGIS, my first post here on GIS. Apologies if the answer to my question is obvious!

I've got regional data loaded into a PostGIS table and want to merge regions that share the same parent name.   (and ultimately output the data as KML.)

This is my query (I'm using php):

SELECT ST_AsTEXT(geom) FROM ST_UNION(ARRAY(SELECT geom FROM RegionsRaw WHERE (ParentName = '" . $parentName . "'))) AS geom;

When I run this script, I'm getting strange results. I can't post a picture because I'm a newbie so check it out here: http://i42.tinypic.com/2qtip8l.png

map region

It's pretty obvious that certain areas are a little messed up and I have a hunch that it's because some of the polygons I'm merging are next to each other (where I'm seeing success) while others are islands and separated from the rest (getting weird results).

Looking for some guidance from the community on this, thanks!

Totally brand new at using PostGIS, my first post here on GIS. Apologies if the answer to my question is obvious!

I've got regional data loaded into a PostGIS table and want to merge regions that share the same parent name. (and ultimately output the data as KML)

This is my query (I'm using php):

SELECT ST_AsTEXT(geom) FROM ST_UNION(ARRAY(SELECT geom FROM RegionsRaw WHERE (ParentName = '" . $parentName . "'))) AS geom;

When I run this script, I'm getting strange results. I can't post a picture because I'm a newbie so check it out here: http://i42.tinypic.com/2qtip8l.png

It's pretty obvious that certain areas are a little messed up and I have a hunch that it's because some of the polygons I'm merging are next to each other (where I'm seeing success) while others are islands and separated from the rest (getting weird results).

Looking for some guidance from the community on this, thanks!

I've got regional data loaded into a PostGIS table and want to merge regions that share the same parent name  (and ultimately output the data as KML.)

This is my query (I'm using php):

SELECT ST_AsTEXT(geom) FROM ST_UNION(ARRAY(SELECT geom FROM RegionsRaw WHERE (ParentName = '" . $parentName . "'))) AS geom;

When I run this script, I'm getting strange results:

map region

It's pretty obvious that certain areas are a little messed up and I have a hunch that it's because some of the polygons I'm merging are next to each other (where I'm seeing success) while others are islands and separated from the rest (getting weird results).

Looking for some guidance from the community on this, thanks!

Source Link
capikaw
  • 111
  • 1
  • 3

Issue merging multiple polygons using ST_UNION

Totally brand new at using PostGIS, my first post here on GIS. Apologies if the answer to my question is obvious!

I've got regional data loaded into a PostGIS table and want to merge regions that share the same parent name. (and ultimately output the data as KML)

This is my query (I'm using php):

SELECT ST_AsTEXT(geom) FROM ST_UNION(ARRAY(SELECT geom FROM RegionsRaw WHERE (ParentName = '" . $parentName . "'))) AS geom;

When I run this script, I'm getting strange results. I can't post a picture because I'm a newbie so check it out here: http://i42.tinypic.com/2qtip8l.png

It's pretty obvious that certain areas are a little messed up and I have a hunch that it's because some of the polygons I'm merging are next to each other (where I'm seeing success) while others are islands and separated from the rest (getting weird results).

Looking for some guidance from the community on this, thanks!