我试图将一个区域的地图划分为1 km x 1 km的正方形网格,并最终计算并检索落入该地图每个正方形网格中的点数(根据其纬度和经度值).可以在PostGIS中执行此操作吗,如果可以,该怎么办?
I'm trying to divide the map of an area into 1 km x 1 km square grids and ultimately, count and retrieve how many points (given their latitude and longitude values) fall into each square grid of this map. Can this operation be done in the PostGIS, if so, how can I do that?
更新:迈克·托伊斯在这里有详细的答案:
UPDATE: Mike Toews has a detailed answer here:
gis.stackexchange /questions/16374/how-to-to-create-a-regular-polygon-grid-in-postgis
推荐答案我的评论中提到 建立常规网格.要为整个国家/地区制作1公里的网格,这可能是一个挑战,因为地球不是平坦的,并且不能划分为完美的1公里网格.
As mentioned in my comment make a regular grid. To make a 1 km grid for a whole country, this could be challenging, since the earth is not flat and cannot be divided into perfect 1 km grids.
要制作1公里的网格,您需要一个投影坐标系,其长度单位为米. WGS84(EPSG:4326)不能这样做,因为它的单位是经度/纬度.要找到合适的投影系统,您需要找到等面积"投影,例如 Lambert azimuthal等面积投影(LAEA).例如,整个欧洲可以使用 ETRS-LAEA(EPSG:3035),尽管可能在某些地方有些变形.或者,如果在新西兰,则新西兰横轴墨卡托2000 .每个区域通常都有一个很好的投影可以使用.
To make a 1 km grid, you need a projected coordinate system, with length units of metres. WGS84 (EPSG:4326) cannot do this, since it has units of degrees lat/long. To find a suitable projection system, you need to find an "equal area" projection, such as Lambert azimuthal equal-area projection (LAEA). For example all of Europe could use ETRS-LAEA (EPSG:3035), although there might be some distortion in some parts. Or if in New Zealand, New Zealand Transverse Mercator 2000. Each region generally has a good projection to use.
要运行PostGIS查询,您需要使用ST_Transform(geom, 3035)将几何图形投影到网格上(例如,对于ETRS-LAEA).
To run your PostGIS query, you would need to project geometries onto the grid using ST_Transform(geom, 3035) (e.g., for ETRS-LAEA).
更多推荐
可以使用PostGIS来创建一个国家的网格图吗?
发布评论