PostGIS

Why is this Postgis distance query so slow? Postgres' query estimator off by a factor of 10000x?

喜欢而已 提交于 2020-01-03 05:37:12
问题 I'm trying to find all posts that were within a certain distance, but unfortunately for some inputs the query is extremely slow. Here's some examples: -- fast (1 millisecond) SELECT 1 FROM post po WHERE ST_DWithin(po.geog, ST_SetSRID(ST_MakePoint(-47, -70), 4326)::geography, 4500 * 1609.34) LIMIT 10; -- slow (2 seconds) SELECT 1 FROM post po WHERE (po.geog <-> ST_SetSRID(ST_MakePoint(-47, -70), 4326)::geography) < 4500 * 1609.34 LIMIT 10; -- slow (9 seconds) SELECT 1 FROM post po WHERE ST

select radius from ST_MinimumBoundingRadius

我们两清 提交于 2020-01-03 02:01:06
问题 I want to get just radius value from ST_MinimumBoungingRadius. Something like this (from postgresql documentation) works just fine: SELECT radius FROM ST_MinimumBoundingRadius('MULTIPOINT(1 2,3 8,5 6)') So I don't understand, why doesn't work similar query on existing table: SELECT radius FROM (SELECT ST_MinimumBoundingRadius(ST_Collect(geom)) minrad FROM a) b Result of this query is ERROR: column "radius" does not exist Is there any way to extract just radius value? 回答1: The main difference

ogrinfo: symbol lookup error: /usr/local/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

旧时模样 提交于 2020-01-02 08:25:45
问题 ogrinfo: symbol lookup error: /usr/local/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name I am getting above error on parsing shape file ESRI. I need do develop django project with PostGIS and i am trapped here. How do i get rig of it ? 来源: https://stackoverflow.com/questions/35123306/ogrinfo-symbol-lookup-error-usr-local-lib-libgdal-so-1-undefined-symbol-sql

ogrinfo: symbol lookup error: /usr/local/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

孤街浪徒 提交于 2020-01-02 08:25:13
问题 ogrinfo: symbol lookup error: /usr/local/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name I am getting above error on parsing shape file ESRI. I need do develop django project with PostGIS and i am trapped here. How do i get rig of it ? 来源: https://stackoverflow.com/questions/35123306/ogrinfo-symbol-lookup-error-usr-local-lib-libgdal-so-1-undefined-symbol-sql

Grib2 to PostGIS raster — anyone get this to work?

↘锁芯ラ 提交于 2020-01-02 07:28:33
问题 I have an application for which I need to import U.S. National Weather Service surface analyses, which are distributed as grib2 files. I want to pull those into PostGIS 2.0 rasters, do some calculations and modeling, and display the data and model results in GeoServer. Since grib2 is a GDAL-supported format, the supplied raster2pgsql utility should be able to slurp a grib2 right into PostGIS-compatible SQL, and once it's there, GeoServer ought to be able to handle it. However, I'm running

NoMethodError using activerecord_postgis_adapter

落花浮王杯 提交于 2020-01-02 07:03:55
问题 I tried installing activerecord-postgis-adapter as per the README but am unable to create the model instance as I keep getting the error mentioned below: NoMethodError: undefined method `point' for nil:NilClass Here are what my different files look like: Location.rb (the model, updated code) # == Schema Information # # Table name: locations # # id :integer not null, primary key # locatable_id :integer # locatable_type :string # created_at :datetime not null # updated_at :datetime not null #

No liblwgeom when using postgresql84 and postgis on Snow Leopard with MacPorts

試著忘記壹切 提交于 2020-01-02 06:47:53
问题 I'm trying to get my dev environment back up and running after upgrading to Snow Leopard. In particular, I need postgresql and postgis working, but I'm running into the following problem. After installing both with the following: sudo port install postgresql84 postgresql84-server postgis I get errors like the following when I try to load my sql database, which has references to liblwgeom.so ERROR: function public.box3d_in(cstring) does not exist ERROR: incompatible library "/usr/local/pgsql

Postgres GIST vs Btree index

随声附和 提交于 2020-01-02 00:44:21
问题 Following on from my previous question on this topic, Postgres combining multiple Indexes: I have the following table on Postgres 9.2 (with postgis): CREATE TABLE updates ( update_id character varying(50) NOT NULL, coords geography(Point,4326) NOT NULL, user_id character varying(50) NOT NULL, created_at timestamp without time zone NOT NULL ); And I am running following query on the table: select * from updates where ST_DWithin(coords, ST_MakePoint(-126.4, 45.32)::geography, 30000) and user_id

烤面筋(四)——数据的读取之PostGIS

血红的双手。 提交于 2020-01-01 21:20:43
烤面筋(四)——数据的读取 烤面筋(五)——简单要素规范 PostGIS官网 Geometry——PostgreSQL+PostGIS的使用 Table of Contents 1. PostGIS是什么 2. PostGIS特性 3. 连接数据库 1) 创建数据库连接实例 2)指定连接参数、实现连接 4. 查询数据 5. 利用GDAL解析数据 1. PostGIS是什么 PostGIS是对象关系型数据库系统PostgreSQL的一个扩展,PostGIS提供如下空间信息服务功能:空间对象、空间索引、空间操作函数和空间操作符。同时,PostGIS遵循OpenGIS的规范。(via 百度百科) PostGIS is a spatial database extender for PostgreSQL object-relational database. It adds support for geographic objects allowing location queries to be run in SQL.(via postgis.net) PostGIS是对PostgreSQL(一个对象关系数据库)的扩展(变成了一个空间数据库), 增加了对地理对象的支持,可以通过SQL语句实现位置查询。 2. PostGIS特性 PostGIS支持所有的空间数据类型,这些类型包括:点

Django avoids creating PointField in the database when I run python manage.py syncdb

人走茶凉 提交于 2020-01-01 09:38:17
问题 I'm using Django 1.2.3, PostGIS 1.5.2. For some reason when I run python manage.py syncdb it's creating all the other fields in the database from my models but avoids creating a field I named point that supposed to be a PointField. In my model.py files I have imported: from django.contrib.gis.db import models and commented: #from django.db import models my model looks something like this: class MyModel(models.Model): myid = models.AutoField(primary_key=True) title = models.CharField(max