[postgis-users] ST_SnapToGrid details

Egil Möller egil at skytruth.org
Tue Jun 25 02:48:03 PDT 2013


Hi!

I'm implementing a dynamic clustering of points in a map, where if you
zoom out, any area with too many points in it has its points replaced by
a big circle with the number of points it's covering written on it. When
you zoom in, the big circles are gradually replaced with several smaller
circles and finally with individual points.

On the server side this is implemented using ST_SnapToGrid followed by a
group by (with count) over the table with the points. Then for each row
where count < some number, a new select query is done to get the actual
points in the area.

The problem is that I seem to get the are to select points from wrong.
So, here's the question:

    Given that

    ST_SnapToGrid(ST_Point(lon, lat), sizeLon, sizeLat) =
    ST_Point(resultLon, resultLat)

    for a given pair of values resultLon and resultLat, and given
    sizeLon and sizeLat, what are the min and max values for lon and lat?

This does not seem to be documented anywhere in
http://postgis.net/docs/manual-2.0/ST_SnapToGrid.html :(

Best regards,
Egil


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130625/9c99bb3b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 553 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130625/9c99bb3b/attachment.pgp>


More information about the postgis-users mailing list