PostGIS

postgres - ERROR: operator does not exist

强颜欢笑 提交于 2019-12-14 03:57:34
问题 Again, I have a function that works fine locally, but moving it online yields a big fat error... Taking a cue from a response in which someone had pointed out the number of arguments I was passing wasn't accurate, I double-checked in this situation to be certain that I am passing 5 arguments to the function itself... Query failed: ERROR: operator does not exist: point <@> point HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. The query is

postgis query for addresses (with osm data)

谁说我不能喝 提交于 2019-12-14 02:05:32
问题 I want to make queries for addresses to postgis database with data from openstreetmap, check if such address exist in database and if so, get coordinates. Database was filled from .pbf file using osmosis. This is schema for the database http://pastebin.com/Yigjt77f. I have addresses in form of city name, street name and number of street. The most important for me is this table: CREATE TABLE node_tags ( node_id BIGINT NOT NULL, k text NOT NULL, v text NOT NULL ); k column is in form of tags,

PostGIS 2.0.0 install GEOS issue

两盒软妹~` 提交于 2019-12-14 01:39:51
问题 Trying to install PostGIS 2.0.0 on Ubuntu 11.10. I've basically followed the OSGeo instructions found here: http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1110src. I built GEOS 3.3.3. If I type geos-config --version into the terminal, I am returned 3.3.3 . I can run ./configure and make without issue. ./configure ends with: PostGIS is now configured for x86_64-unknown-linux-gnu -------------- Compiler Info ------------- C compiler: gcc -g -O2 C++ compiler: g++ -g -O2 -------------

Work with Postgres/PostGIS View in SQLAlchemy

。_饼干妹妹 提交于 2019-12-14 00:38:40
问题 Two questions: i want to generate a View in my PostGIS-DB. How do i add this View to my geometry_columns Table? What i have to do, to use a View with SQLAlchemy? Is there a difference between a Table and View to SQLAlchemy or could i use the same way to use a View as i do to use a Table? sorry for my poor english. If there a questions about my question, please feel free to ask so i can try to explain it in another way maybe :) Nico 回答1: Table objects in SQLAlchemy have two roles. They can be

Type geometry not found with postgis and hibernate-spatial

試著忘記壹切 提交于 2019-12-13 21:43:08
问题 I'm trying to setup a project with hibernate-spatial using postgis. Following the tutorial for hibernate-spatial 4.0-M1 I first run into the problem that the dependency postgis-jdbc-1.5.3.jar couldn't be found. Like suggested here by somebody I used the version 1.5.2 and the tutorial compiles. But I got an error if I try to run it. I set the debug-level for hibernate to debug und stumbled upon the following problem: DEBUG SQL - create table Event ( id int8 not null, date timestamp, location

Select a random entry from a group after grouping by a value (not column)?

本秂侑毒 提交于 2019-12-13 15:24:09
问题 I want to write a query using Postgres and PostGIS. I'm also using Rails with rgeo , rgeo-activerecord and activerecord-postgis-adapter , but the Rails stuff is rather unimportant. The table structure: measurement - int id - int anchor_id - Point groundtruth - data (not important for the query) Example data: id | anchor_id | groundtruth | data ----------------------------------- 1 | 1 | POINT(1 4) | ... 2 | 3 | POINT(1 4) | ... 3 | 2 | POINT(1 4) | ... 4 | 3 | POINT(1 4) | ... ---------------

Insert/Update PostGis Geometry with Sequelize ORM

牧云@^-^@ 提交于 2019-12-13 12:08:36
问题 I have extracted models of some PostGis layers with sequelize-auto, giving: module.exports = function(sequelize, DataTypes) { return sequelize.define('table', { id: { type: DataTypes.INTEGER, allowNull: false, primaryKey: true, autoIncrement: true }, geom: { type: DataTypes.GEOMETRY('POINT', 4326), allowNull: true, }, ... On GET sequelize sends the geom to the client as GeoJSON: { "type":"Point", "coordinates":[11.92164103734465,57.67219297300486] } When I try to save this back PosGis errors

Compound OR SQL query (query #1 with WITH) and (query #2) with COUNT() excusions

不羁岁月 提交于 2019-12-13 06:03:54
问题 EDIT Yes, you are correct. What I am looking for in pseudo code is a list that (st_area(geom)>0.1) OR (COUNT(*) > 1) and in words: return a list, that only has only states that have an area greater than 0.1, but don't exclude that state if it is the only one in the country (usually and island country, which has plenty room for labels next to it). The excluded states are places like Slovenia that has 100 provinces, but a tiny land area (Great Britain is also and offender). I have a table for

How to express the projection using pure sql?

╄→гoц情女王★ 提交于 2019-12-13 06:01:49
问题 I have used RGEO_FACTORY = RGeo::Geographic.simple_mercator_factory RGEO_FACTORY.point(lon, lat).projection But now I want to use sql to implement it. And I have the point(geometry) in the postgis database. How should I do ? 回答1: RGeo simple mercator factory docs state that it uses SRID 4326 to store points and SRID 3785 for projections. PostGIS has ST_Transform for that. Here's a nice tutorial covering the topic. Suppose you store your geom field in 'nodes' table and it's in SRID 4326, then

Spatial Data SQL Reprojection Function issues

放肆的年华 提交于 2019-12-13 05:47:07
问题 Hello I am just learning postGIS and thus postgresql (9.1) and am trying to save some time copying the same code over and over by creating an sql function to reproject some spatial data. Create Function reproject_shapefile(text,text,numeric) returns void as $$ -- Reprojects shapefiles given that they follow the pattern "gid * the_geom" CREATE TABLE $2 AS SELECT *, ST_Transform(the_geom,$3) AS the_geom2 FROM $1; Alter table $2 add Primary Key (gid); Alter table $2 drop column the_geom; Alter