PostGIS

Postgresql vs Oracle for maintaing GIS data

≯℡__Kan透↙ 提交于 2019-12-11 19:16:24
问题 We currently maintaining GIS data using oracle and ArcSDE. However, we want to explore better and cheaper alternatives. We came across using postgresql for maintaining gis database. Our business requires linear referencing and versioning capabilities. Also need to have topology and featuredatasets. I am new to Postgresql. So, I do not know any thing about its performance and stability. Can you guys share your experience with respect to postgresql performance and stability in comparision with

Odbc_fdw.control is missing

泪湿孤枕 提交于 2019-12-11 18:09:53
问题 I am using cartoDB and Postgres 9.3 including PostGIS. When I try to create development user in cartoDB I get this error: 'CREATE EXTENSION IF NOT EXISTS odbc_fdw SCHEMA public;' ERROR: could not open extension control file "/usr/share/postgresql/9.3/extension/odbc_fdw.control": No such file or directory Also, when I try to run odbc_fdw extension inside Postgres I get the same error. Any idea how to fix it? 回答1: You have to install the files odbc_fdw--0.0.1.sql and odbc_fdw.control in the

pgr_astar and impossible edges (e.g., locked doors)

孤者浪人 提交于 2019-12-11 17:45:39
问题 I'm using postgresql / PostGIS with pgrouting and I need to compute the shortest path. In a previous version of pgrouting, I was using shortest_path_astar. In my routing graph I had impossible segments, such as locked doors. I used: SELECT id FROM shortest_path_astar('SELECT edge_id AS id, vertex_id1 AS source, vertex_id2 AS target, ' || '(CASE WHEN door = ''S'' THEN -1.0 ELSE (length) ) END)::float8 AS cost, ' || '(CASE WHEN door_rev = ''S'' THEN -1.0 ELSE (length) ) END )::float8 AS reverse

Postgres split LineStrings and convert

情到浓时终转凉″ 提交于 2019-12-11 14:48:13
问题 my question is how to build a function in PL/pgSQL to do this : i have many linestrings like this. Linestring((3.584731 60.739211,3.590472 60.738030,3.592740 60.736220)) I need to split every Linestring in a Substring and split it up again in 2 coordinates like this. 3.584731 60.739211 x1 y1 3.590472 60.738030 x2 y2 3.592740 60.736220 x3 y3 And so on with the other points. Save the answers and converting into a double so I can calculate with the points. 回答1: Use ST_DumpPoints like this:

Spring JdbcTemplate update Postgis geography column

泄露秘密 提交于 2019-12-11 13:42:18
问题 I'm trying to update the Postgis geography column with Lon and Lat with the code below public void updateGeoLocation(String lat, String lon) { template.update( "UPDATE property set geo = ST_GeomFromText('POINT(? ?)', 4326) where id = 'b15e7a7e-3b27-4a2f-b312-33ebbed594b5'", lon, lat); } But I get the following exception org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [UPDATE property set geo = ST_GeomFromText('POINT(? ?)', 4326) where id = 'b15e7a7e

Pixel values of raster records to be inserted in the table as columns

不想你离开。 提交于 2019-12-11 10:49:01
问题 I have a table with following columns: (ID, row_num, col_num, pix_centroid, pix_val1). I have more than 1000 records. I am inserting my data using: insert into pixelbased (row_num, col_num, pix_centroid, pix_val) select (ST_PixelAsPolygons(rast, 1)).x as X, (ST_PixelAsPolygons(rast, 1)).y as Y, (ST_Centroid((ST_PixelAsPolygons(rast, 1)).geom)) as geom, (ST_PixelAsPolygons(rast, 1)).val as pix_val1 from mytable where rid=1` Now I am trying to insert all the other records as a column and _pix

sequelize beforeSave hook not firing

落花浮王杯 提交于 2019-12-11 10:09:59
问题 I've generated models with sequelize-auto, and need to use a beforeSave hook (see here). The hook isn't firing as far as I can tell. sequelize version ^4.20.1, sequelize-auto version ^0.4.29, express version ~4.15.5. Can anyone help? module.exports = function(sequelize, DataTypes) { return sequelize.define('trad', { id: { type: DataTypes.INTEGER, allowNull: false, primaryKey: true, autoIncrement: true }, geom: { type: DataTypes.GEOMETRY('POINT', 4326), allowNull: true }, ... }, { hooks: {

Postgis - How to work with data type 'geography' via JDBC

╄→гoц情女王★ 提交于 2019-12-11 09:31:23
问题 Working on a web project, which uses postgresql 9.3 postgis 2.1 . There is a column of type geography in the table, it just store a point . Now I need to insert / select the type via JDBC with Java object. After reading postgis manual, didn't find much information relevant. The questions are: In java pojo model class, what Java data type should be used for the column? How to write the insert sql? How to write the select sql to retrieve the value and put into Java object? If mybatis is used,

Postgis Error when upgrading to Rails 4

给你一囗甜甜゛ 提交于 2019-12-11 09:19:17
问题 My team and I are going through a maintenance phase currently, and I've been busy upgrading everything. Last week I moved the team from PostgreSQL 9.1 to 9.3 and PostGIS 1.5 to 2.1 which all went smoothly. Yesterday, the Rails team submitted a Rails 4 upgrade pull request that our CI swiftly rejected. Any suggestions would be greatly appreciated. When attempting to create a new test database, I receive the following Rails error: PG::RaiseException: ERROR: PostGIS is already installed in

How to find all points within polygon in postgis?

被刻印的时光 ゝ 提交于 2019-12-11 08:49:15
问题 I have locations stored in location_table (point_location geometry), now i draw a polygon on google map and pass that polygon (geometry) to backend, I want to find all the locations that are within that polygon. SELECT POINT_LOCATION FROM LOCATIONS_TABLW WHERE ST_Contains(GeomFromEWKT(?), POINT_LOCATION); This is giving me random results when I pass the polygon from google maps to backend. Its not giving me all points that are exactly within the polygon. It gives me points that are even