Hi Martin,

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.

Ok, I'll submit a bug report.


- 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)

Good point, you are right.

However, is this another bug then?

select astext(extent(GeomFromText('POINT(-104 40)')))

"POLYGON((-104 40,-104 40,-104 40,-104 40,-104 40))"


But luckily, this actually works:

select astext(extent(collect(envelope(GeomFromText('POINT(-104 40)')), envelope(GeomFromText('POINT(-105 39)')))))

"POLYGON((-105 39,-105 40,-104 40,-104 39,-105 39))"

So that solves my issue.

I will file these both as bug reports - thanks for your help Martin!

Charlie

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to