Extents of postgres data

1 message Options
Embed this post
Permalink
Andy Bailey-2

Extents of postgres data

Reply Threaded More More options
Print post
Permalink
I would like to be able to use the query
"select extents(x.geometry) from Road x"

and also estimated_extent(x.geometry)

but it gave me an error that extents was not defined

I cant see it in the source code.

In PostgisDialect the following method isnt implemented
        public String getSpatialAggregateSQL(String columnName, int
aggregation,
                        boolean isProjection) {
                // todo needs implemented
                throw new UnsupportedOperationException(
                                "This method is not yet supported in PostGis");
        }

which is a bit worrying, it would be so useful to determine the extents
quickly.

How can I use the extents function?


My workaround is as follows, but its obviously not as fast.

In the Entity class Roads I have defined
@NamedQuery(name = "Road.getExtents", query = "select
envelope(x.geometry) from Road x"),


in the main class I use the code:

String queryName = "Road.getExtents";

Query query = em.createNamedQuery(queryName);

List<Polygon> polygons = query.getResultList();
Envelope envelope = new Envelope();
for (Polygon polygon : polygons)
{     envelope.expandToInclude(polygon.getEnvelopeInternal());
}

Andy Bailey
www.hazlorealidad.com


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users