PostGIS

How can I query all my data within a distance of 5 meters?

时光怂恿深爱的人放手 提交于 2019-12-21 02:48:31
问题 I am using GeoDjango with PostGIS. Then I am into trouble on how to query my postgres db table to get all data within a distance of 5 meters. UPDATES1 I am using GeoDjango 1.2.7 I found something from this url https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoquerysets/#std:fieldlookup-distance_lte Zipcode.objects.filter( poly__distance_lte =( geom , D (* m *=5))) But don't know on how to prepare the parameter and variables. what is poly_distance_lte ? is a function? what is geom ? is

Postgresql: Can't access to file « $libdir/postgis-2.1 » no such file or directory

こ雲淡風輕ζ 提交于 2019-12-20 22:00:01
问题 I guess this is a known issue but since I have used a script that removed my postgresql-9.4-postgis-2.1, I'm now unable to get rid of this SQL error under Debian. Can't access to file « $libdir/postgis-2.1 » no such file or directory I've done the following: - Remove new unwanted postgresql-9.5-postgis-2.2 package installed - Reinstalling postgresql-9.4-postgis-2.1, postgresql-9.4-postgis-scripts and postgis - Using SQL: ALTER EXTENSION postgis UPDATE TO '2.1.4' --under postgres user - Using

how to change install postgis location? postgres

怎甘沉沦 提交于 2019-12-20 11:52:31
问题 When I am in my postgres db and tried to create an extension for my db, I get this error ERROR: could not open extension control file "/usr/share/postgresql/9.5/extension/postgis.control": No such file or directory I know there are so many posts out there with this error and solutions and I tried them all too. Found so much in stackoverflow but none of them worked. I realized in my postgresql directory there are 9.2 , 9.3 , 9.4 , 9.5 , 9.6 , I went into the directory in the error and I

Postgis / Geodjango: Cannot determine PostGIS version for database

陌路散爱 提交于 2019-12-20 09:33:50
问题 I'm attempting to launch a GeoDjango app. I've installed Postgres & PostGIS using brew on Lion. I created a database using template_postgis: createdb -T template_postgis test . When I run python manage.py syncdb , I get the following error: django.core.exceptions.ImproperlyConfigured: Cannot determine PostGIS version for database "test". GeoDjango requires at least PostGIS version 1.3. Was the database created from a spatial database template? How can I track down the source of the error? I

AttributeError: /usr/lib/ogdi/libgdal.so: undefined symbol: GDALVersionInfo

こ雲淡風輕ζ 提交于 2019-12-20 05:59:23
问题 I have setup the database using geodjango documentation and when I am doing python manage.py sqlall world I am getting this error: OSError: /home/nishant-un/local/lib/libgdal.so: cannot open shared object file: No such file or directory And when I locate libgdal.so I found it in: /usr/lib/ogdi/libgdal.so So I changed the GeoDjango Settings: GDAL_LIBRARY_PATH = '/home/nishant-un/local/lib/libgdal.so' to GDAL_LIBRARY_PATH = '/usr/lib/ogdi/libgdal.so' Then When I do python manage.py sqlall world

postgis not available for all postgres users

余生颓废 提交于 2019-12-20 05:18:11
问题 When creating a new user on our Potgis enabled database I run into the strange issue that that new user cannot access the postgis extension while earlier created users can. With my user account I get the following output: mydb => SELECT postgis_version(); postgis_version --------------------------------------- 2.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 (1 row) With the new user I get the following: mydb => SELECT postgis_version() mydb-> ; ERROR: function postgis_version() does not exist LINE 1:

build SQL dynamic query with psycopg2 python library and using good conversion type tools

放肆的年华 提交于 2019-12-20 03:37:08
问题 I have some problem to design a good algorithm which use specification of psycopg2 library described here I want to build a dynamic query equal to this string : SELECT ST_GeomFromText('POLYGON((0.0 0.0,20.0 0.0,20.0 20.0,0.0 20.0,0.0 0.0))'); As you can see, my POLYGON object contain multiple point, read in a simple csv file some.csv which contain : 0.0;0.0 20.0;0.0 20.0;20.0 0.0;20.0 0.0;0.0 So i build the query dynamically, function of the number of line/data in the csv. Here my program to

Import OSM file to PostGis on Windows10

不打扰是莪最后的温柔 提交于 2019-12-20 03:36:14
问题 can you help me with importing planet.osm file to my PostGist db? I am new in this and I found tutorials only for linux. There are some commands, but I do not know how use it ... I will be grateful for some step by step tutorial. I'm using GeoServer if it is important information for us to help me. Thanks for advices. edit: I used osm2pgsql -s -U postgres -d nameofdatabase name.osm but unsuccessful because I have error with no database found. 回答1: I used OGR2OGR to import osm data in pbf

Poor performance on a PostgreSQL query

谁都会走 提交于 2019-12-20 02:34:40
问题 UPDATE: Just occurred to me: Is it possible that pgAdmin counts not the actual time of the query, but the time required to draw the results in the grid? I just executed the query using the command line (psql) and output the results in a txt file and it was very swift (1-2 seconds tops). In that case, the issue is not a postgresql / ubuntu server configuration; it is rather a display adapter's problem. Am I right or searching in the wrong direction? On my "old" PC (Core 2 Duo, 4GB RAM, 250GB

postgis相关函数

眉间皱痕 提交于 2019-12-19 15:05:48
多边形表示方式:geom (lng lat, lng lat) 多边形向外等距扩展50m 0.0005表示50 SELECT ST_AsText( st_buffer ( 'POLYGON((' || A .WGS84 || '))', 0.0005 )),a.id FROM hospital_area_new_result_id A 以经纬度一点画半径为50m的圆 SELECT ST_AsText( st_buffer ( 'POINT('|| b.longitude || ' ' || b.latitude ||')', 0.0005 )),a.id FROM hospital_area_new_result_id A 判断经纬度点是否在多边形内 SELECT ST_Contains ( ST_Transform ( st_geometryfromtext ( 'POLYGON((' || A .WGS84 || '))', 4326 ), 4527 ), ST_Transform ( st_geometryfromtext ( 'POINT(' || b.longitude || ' ' || b.latitude || ')', 4326 ), 4527 ) ) FROM hospital_area_new_result_id_center A ,food_hospital