Spatial Clustering of Introduction to postgis (2)

Source: Internet
Author: User
Tags postgis

The previous article mainly introducedSt_snaptogrid. Now we use the features table in the previous articles for the following applications:

This section briefly describes the methods used:

GeometrySt_collect (Geometry[] G1_array); combines a series of geometries into a single st_geometry (the old version is called geometrycollection ).

GeometrySt_multi (GeometryG1); converts G1 to a multi * geometry.

As with the previous methods, connect to the database, open the query visualization box, and add the following SQL:

  select   st_multi (st_collect (the_geom ))   as   the_geom, st_astext (st_multi (st_collect (the_geom) 
from features
group by st_snaptogrid (st_transform (the_geom, 2327 ), 2000 , 2000 )

Aggregates points in features into a grid of 2000*2000 m²,St_transform (the_geom,2327) Is to convert the coordinate system from 4326 to 2327, because the measurement unit of 4326 is degree, 2327 (here I randomly find a Xi'an 80 COORDINATE SYSTEM) should be meters. St_astext (st_multi (st_collect (the_geom) is not very useful, but it is easy to edit styles in qgis.

Change the grid size to 5000*5000:

SelectSt_multi (st_collect (the_geom ))AsThe_geom, st_astext (st_multi (st_collect (the_geom )))
FromFeatures
Group BySt_snaptogrid (st_transform (the_geom,2327),5000,5000)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.