PostGIS

shp2pgsql, psql command not found through ProcessBuilder Java

一曲冷凌霜 提交于 2019-12-11 08:41:45
问题 The following command works well in command line shp2pgsql -s 4326 /Users/abc.shp | psql -U user1 -h localhost -p 5432 -d postgis However when I run the following command in Java using ProcessBuilder it says command not found. Here is the code: public static void main(String arg[]) throws Exception { ProcessBuilder pb = new ProcessBuilder("/bin/sh -c shp2pgsql /Users/abc.shp | psql -U user1 -h localhost -p 5432 -d postgis"); Process p = pb.start(); showOutput(p.getInputStream(), System.out);

Postgis : How to make only one query with 2 queries

此生再无相见时 提交于 2019-12-11 05:54:02
问题 Traces db : A trace is an hiking path create_table "traces", force: :cascade do |t| t.string "name" t.geometry "path", limit: {:srid=>4326, :type=>"line_string"} end Pois db : A Poi is a Point of Interest (city, castel...) create_table "pois", force: :cascade do |t| t.string "address" t.string "address2" t.integer "zip_code" t.string "city" t.string "department" t.string "region" t.float "latitude" t.float "longitude" t.geography "lonlat", limit: {:srid=>4326, :type=>"st_point", :geographic=

config jsor library to make symfony 2/doctrine 2 work with postgis extension

谁说我不能喝 提交于 2019-12-11 05:18:48
问题 Working with Symfony 2.8.24 and PostGIS I need to THE TITLE . I found this in github but the problem is the configuration steps there didn't help me a lot. I don't know if it is because I can't use composer online (proxy) to install it as the first step states. IRDK where to start, for example, I don't see the path 'Jsor\Doctrine\PostGIS\Types\GeographyType' anywhere in the files I am using so I don't know where to copy them to use them, or maybe it has nothing to do with it. I know it's

postgresql postgis If point inside circle

こ雲淡風輕ζ 提交于 2019-12-11 04:53:13
问题 I'm using postgresql as db , i have the table named car_wash with field "point geometry"(use postgis) so in application I'm getting lon lat from user using GOOGLE API, next step I need to create circle around user and check if car_wash inside this circle I use select * from car_wash cw where ST_DWithin ( cw.lon_lat, ST_GeomFromText('POINT(54.21 22.54)') )=false AND not cw.was_deleted Is it corect way? IF you need my srid is 0 according to this query Select Find_SRID('public', 'car_wash', 'lon

What is the source of “unknown OID” errors in Rails?

好久不见. 提交于 2019-12-11 04:25:08
问题 When replicating an app to production, my POSTGIS table columns started misbehaving, with Rails informing me there was an "unknown OID 26865" and that the fields would be treated as String. Instead of current_pos yielding e. g. #<RGeo::Geographic::SphericalPointImpl:0x22fabdc "POINT (13.39318248760133 52.52908798020595)"> I would get 0101000020E6100000FFDD958664C92A403619DEE6B2434A40 . It looked like the activerecord-postgis-adapter was not installed, or installed badly, but I eliminated that

Fast find near users using PostGIS

爱⌒轻易说出口 提交于 2019-12-11 03:19:36
问题 I have 5 tables: - users - information about user with current location_id (fk to geo_location_data) - geo_location_data - information about location, with PostGIS geography(POINT, 4326) column - user_friends - relationships between users. I want to find near friends for current user, but it takes a lot of time of executing select query to know if user is a friend and after that execute select using ST_DWithin . May be something wrong in domain model or in queries? 回答1: The first step is to

GeoDjango GeoQuerySet.distance() results in 'ST_Distance output only available on GeometryFields' when specifying a reverse relationship in field_name

让人想犯罪 __ 提交于 2019-12-11 03:14:56
问题 From the docs and other questions, sorting a GeoQuerySet by distance should be straightforward, but I'm having trouble getting it work. Here is an example to demonstrate the situation of the problem: Lets say I got two models in two different apps. One model in appA and another in appB as defined below: # appA/models.py class Store(models.Model): title = models.CharField() # appB/models.py from appA.models import Store class StoreLocation(models.Model): store = models.ForiegnKey(Store)

Upgrading from PostGIS 2.1: “Error: attempt to redefine parameter ”postgis.backend"

自闭症网瘾萝莉.ら 提交于 2019-12-11 02:41:56
问题 Upgrading from PostGIS 2.1: "Error: attempt to redefine parameter "postgis.backend" I am trying to upgrade my PostGIS database on AWS RDS, but I am getting an error when running ALTER EXTENSION postgis UPDATE , as shown below: my_db=> alter extension postgis update; ERROR: attempt to redefine parameter "postgis.backend" And here is some additional information about my database: my_db=> select distinct probin from pg_proc where probin like '%postgis%'; -[ RECORD 1 ]----------------- probin |

Why my postgis not use index on geometry field?

£可爱£侵袭症+ 提交于 2019-12-11 02:32:37
问题 postgresql 9.5 + postgis 2.2 on windows. I firstly create a table: CREATE TABLE points ( id SERIAL, ad CHAR(40), name VARCHAR(200) ); then, add a geometry field 'geom': select addgeometrycolumn('points', 'geom', 4326, 'POINT', 2); and create gist index on it: CREATE INDEX points_index_geom ON points USING GIST (geom); then, I insert about 1,000,000 points into the table. I want to query all points that within given distance from given point. this is my sql code: SELECT st_astext(geom) as

Insert PostGIS Object (e.g. ST_GeomFromText) from row variables in plpgsql script

故事扮演 提交于 2019-12-11 00:54:00
问题 I have two tables src_pos and dest_pos. The src_pos stores positions with longitude, latitude and altitude, while the dest_pos stores PosGIS Geometry object. Now I want to move a bunch of data from src_pos to dest_pos with following plpgsql script. But it failed, because row vaiable (e.g. row_data.longitude) cannot be interpreted correctly. How can I overcome this problem!? --create language 'plpgsql'; drop function createPosition(); create function createPosition() returns integer AS $$