PostGIS

creating a polygon from points around a point in postgis

[亡魂溺海] 提交于 2019-12-13 00:42:13
问题 I have a postgresql db using postgis 2.0 and a table of thousands of points, I would like create a polygon of the furthest points originating around a particular central location. I haven't got a clue how this would be done, any ideas anyone?? 回答1: Filter and aggregate the points, and return the convex hull of the points. So to select the points in mytable that are within a distance of 10 from id=123, and return the enclosing polygon: SELECT ST_ConvexHull(ST_Collect(A.geom)) FROM mytable A,

Find Y value of an interpolated point in a Linestring given an X value on Postgis

倾然丶 夕夏残阳落幕 提交于 2019-12-13 00:03:04
问题 I would like to know what's the best way to find the Y value of an interpolated point inside the Linestring , when given the X . The X coordinates of my input Linestring will always be incremental and non sequential (as in the example below). The Y values could be any real number. LINESTRING(223 -59,228 -59.3,233 -59.7,242 -60,263 -60.4, 268 -61.7,275 -62.1,280 -62.5) Given an X value (let's say 270 for example), the query would output the interpolated value inside the Linestring (in this

How i can update point type data using JPA native query?

冷暖自知 提交于 2019-12-12 22:43:07
问题 I wrote the query to update but i'm getting error in it. @Modifying @Transactional @Query(value = "UPDATE lat_lang SET geom=ST_transform(ST_SetSRID(ST_MakePoint(:lat,:lang),4326),3857),latitude=:lat,longitude=:lang WHERE uid=1;", nativeQuery = true) int updateGeom(@Param("lat") Double lat, @Param("lang") Double lang); I'm getting this error org.postgresql.util.PSQLException: ERROR: function st_makepoint(bytea, bytea) does not exist Hint: No function matches the given name and argument types.

Does PostGIS automatically convert upon inserting WKT?

偶尔善良 提交于 2019-12-12 19:21:50
问题 I'm quite new to PostGIS so bear with me. Suppose I have a table defined as follows: CREATE TABLE gtest (name varchar, geom geometry); At first, to insert, I was doing something like: INSERT INTO gtest VALUES ( 'Polygon', ST_GeomFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))',4326) ); I then discovered that it still works by only doing this: INSERT INTO gtest VALUES ( 'Polygon', 'SRID=4326;POLYGON((0 0,1 0,1 1,0 1,0 0))' ); When I do a query without converting the geom values back into WKT, they

Slow query when comparing geometries

ぐ巨炮叔叔 提交于 2019-12-12 19:07:25
问题 I am trying to compare and create a new table. But its taking more time to compare. Table 1 (schema) +-------------+----------+-------------+ | Column | Type | Modifiers | |-------------+----------+-------------| | line_id | bigint | | | junction | integer | | | geom | geometry | | +-------------+----------+-------------+ Indexes: "points_geom_gix" gist (geom) Where junction contains either 0 or 1. Table 2 +----------+----------+-------------+ | Column | Type | Modifiers | |----------+-------

How to install Postgis to a Keg installation of Postgres@9.5 using Homebrew?

流过昼夜 提交于 2019-12-12 18:19:17
问题 I have installed Postgresql@9.5 to my OSX El Capitan Machine using Homebrew 1.2. Unfortunately, upon installing Postgis, and performing CREATE EXTENSION postgis; It returns, ERROR: could not open extension control file "/usr/local/Cellar/postgresql@9.5/9.5.6/share/postgresql@9.5/extension/postgis.control": No such file or directory I tried, uninstalling all postgresql and install only the 9.5 version, and then installing postgis but to no avail. I think I got a similar question but this one

Type geometry does not exist after CREATE EXTENSION postgis

吃可爱长大的小学妹 提交于 2019-12-12 15:43:06
问题 After creating new postgres db and loading necessary postgis extension $ createdb demodb $ psql demodb > CREATE EXTENSION postgis; > CREATE EXTENSION postgis_topology; I get django.db.utils.ProgrammingError: type "geometry" does not exist exception thrown while running django manage.py migrate After this I tried running the failed query in pgadmin and it said the same: type "geometry" does not exist Although appending CREATE EXTENSION postgis; before the query seems to fix this and query

RGeo error attempting to create point from lat/lon

為{幸葍}努か 提交于 2019-12-12 14:05:54
问题 I'm writing an app which I am attempting to integrate some general geolocation functionality including saving some lat/lon coordinates as a point in a database. The intention of this is to allow the user to either use their location (provided by device) or a google map marker to choose their coordinates. I have succeeded at obtaining the coordinates from the map or device, however I am having trouble now creating a point from them to save into the db. I've read the documentation and tried

Is ST_GeomFromText better than providing direct geometry?

♀尐吖头ヾ 提交于 2019-12-12 13:32:15
问题 I have been working with postgis recently,and in my query if I use ST_GeomFromText it execute faster than running a sub-query to get geom. I thought ST_GeomFromText will be more expensive but after running many tests every time I got the result faster, my question Is there any explanation behind this? because for me getting the geom directly in sub-query is better than getting geom as text then added as GeomFromText. Thanks, Sara 回答1: Your issue is that the issues are different. ST

Unable to syncdb in GeoDjango App

随声附和 提交于 2019-12-12 09:40:06
问题 I am having a real trouble in setting up spatial database and syncing it with GeoDjango. I was able to setup the spatial database as per the geodjango documentation and create a django app but when i run python manage.py sqlall world I am getting this, Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/smaranh/django-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from