我有一个用例,其中我需要检索有限数量的记录,这些记录具有听到地理空间点的位置。类似于:
SELECT * FROM table WHERE location is near (x, y) LIMIT 200
我想使用PostGIS。但我不知道它是否支持这种查询。因为我不想检索边界框中的记录,而是检索根据其到指定点的距离排序的有限数量的记录。我在PostGIS的文档中没有找到关于它的信息。
如果PostGIS支持它,它是否可扩展?这是我的应用程序中最常用的查询。而且记录的数量非常大。
我知道MongoDB有$near查询。它是否具有可扩展性?
当我尝试使用psql中的h命令时
select PostGIS_full_version();
我知道错误:
ERROR: function postgis_full_version() does not exist
LINE 1: select PostGIS_full_version();
^
HINT: No function matches the given name and argument types.
You might need to add explicit type casts.
我安装了PostGIS 2,yum list postgis*
我试图将数据从PostGIS传递给铯,我相信更简单的方法是使用GeoJSON。
为了测试它,我对我的PostGIS做了一个查询,以获得一些geoJSON数据
SELECT ST_AsGeoJSON(mygeom)
FROM mytable where id = 370;
然后,我将结果复制到铯沙堡,看看它是如何工作的。
var viewer = new Cesium.Viewer('cesiumContainer');
const greenPolygon = viewer.entities.add({
name: "Green extruded polygo
我在一个PostGis数据库中存储了一个空间分布的实体E集合,并对其进行了空间索引。
每个实体都有许多索引的非空间属性,如类型、值等。
对于以下类型的查询,是否有计算效率高的查询模板:
"find the centroid of the circular region with radius X which includes the most E such that (some condition based on attribue values)"
例如
"find the centroid of the circular region with radius 1Km
在postgis查询之后,为所有点创建缓冲区,然后获取与用户位置相交的点(该位置也由常量值缓冲):
SELECT id, created_at, ST_AsGeoJSON(the_geom) FROM table WHERE ST_INTERSECTS(ST_Buffer(ST_GeomFromText('POINT(x y)',4326)::geography, 150)::geometry,
ST_Buffer(the_geom::geography, 100*(seenCount+1))::geometry) ORDER BY created_at DESC
我想将我们
我已经安装了postgresql-9.4和potsgresql-contrib,并且正在尝试添加以下内容:
sudo apt-get install postgis postgresql-9.4-postgis-2.1
但我得到了这样的信息:
The following packages have unmet dependencies:
postgis : Depends: libgdal1 (>= 1.9.0) but it is not going
to be installed postgresql-9.4-postgis-2.1 : Depends: libgdal1 (&
我使用PostGIS的Radius查询函数,使用地理列在radius内查找点:
select count(*) from goeocde_table WHERE ST_DWithin(geog, ST_MakePoint(-76.07,36.21),640000) ;
我在测柱顶部定义了一个空间索引。然而,我看到了一个巨大的性能影响,只要我增加半径。这是意料之中吗?
我们有一些地理数据,你可以把它们看作是地名。
我们有将近六十万份记录,每一份记录都有以下几个字段:
id name lng lat ....
现在我们想要根据这些字段进行搜索,支持模糊搜索,但是使用like的数据库并不是一个好主意。
所以我们尝试Lucene进行全文搜索,这对于name字段查询很好,但是我不知道什么时候查询和混合name字段和lng lat字段。
例如,用户可能会想要查询包含关键字"xxx“在某一特定点附近的地方: lat:30,lng 40,距离100米。
这是一种地理查询,我认为最好像postgis之类的空间数据库来查询,但是“`name”字段怎么样?
我在psql中运行了命令:
my-spatial-db=# CREATE EXTENSION postgis;
并得到错误:
ERROR: could not open extension control file "/usr/share/pgsql/extension/postgis.control": No such file or directory
my-spatial-db=# select postgis_full_version();
NOTICE: Function postgis_gdal_version() not found. Is raster
我正在尝试使用Postgis设置Geodjango,但无法在数据库中启用Postgis扩展。我正在遵循上的设置,但当我点击此步骤时:
mydb=# CREATE EXTENSION postgis;
我得到以下错误:
ERROR: could not open extension control file "/usr/local/Cellar/postgresql/9.3.1/share/postgresql/extension/postgis.control": No such file or directory
这是我的路径的问题吗?如果是这样,我该如何修复它?我发现我的
在postgis安装失败后
CREATE EXTENSION PostGIS WITH SCHEMA postgis;
ERROR: could not open extension control file "/usr/local/Cellar/postgresql@9.5/9.5.12/share/postgresql@9.5/extension/postgis.control": No such file or directory
在此页面上搜索适用于使用psql 9.5.12的Mavericks设置的版本:
https://github.com/Homebrew/ho