Charlie,
Two observations:
- This does look like a bug, or at least a porting problem in GEOS. In
JTS, the envelope of a Point is itself a Point. This means that the
return value is always a valid geometry, and thus can be safely used in
further operations.
- Are you sure you want to compute the union of the bounding boxes,
rather than the bounding box that contains them both? If the latter is
the case, perhaps the ST_extent function is what you want. (In raw
GEOS, there should be an Envelope.expandToInclude function which does this)
Martin
Charlie Savage wrote:
Hi Carl,
Charlie ,
neither of those polygons are valid
repeating points, self intersecting and the second one is not a
closed linestring
Interesting - that is what PostGis/Geos produces when you do this:
select astext(envelope(GeomFromText('POINT(-104 40)')))
"POLYGON((-104 40,-104 40,-104 40,-104 40,-104 40))"
But you are right, PostGis doesn't think they are valid:
select isvalid(envelope(GeomFromText('POINT(-104 40)')))
False
And this did work in older versions of GEOS - maybe it shouldn't have.
So here is my problem then. I have a map, a user enters a point. I
want to store the bounding box. So I use the envelope function as
above. User enters another point. Find its bounds. Then union them
together. I don't want to recalculate the bounds based on all the
points each time because its too expensive finding all the constituent
geometries.
Ideas?
Charlie
------------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users
--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users