PostGIS

Get projection limits from Postgis

雨燕双飞 提交于 2019-12-11 00:48:35
问题 I receive spatial queries to my API in lat/lon coordinate pairs. My spatial data is in projections that don't cover the entire globe, which follows that some queries are out of bounds. I'd like to respond to wrong queries with helpful error message. Rather than try to find out some in GIS specifications or standards what boundaries each projection has (and getting correct lat/lon pairs from those), I'd like to know wether I could either ask the limits from Postgis or ask if specific point is

Geodjango Exception when importing django.contrib.gis.gdal: OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

僤鯓⒐⒋嵵緔 提交于 2019-12-11 00:27:59
问题 I have followed the tutorial for installing Geodjango on my Ubuntu 14.04. I am using Django 1.10 and Python 3.5, postgres-9.6 and postgis 2.3. I have checked here and here, but found no solution. In a newly installed ubuntu 14.04 Virtual Machine, it worked. But in my installation, when I tried making migrations, I got: OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name Investigating a bit further, I tried simply: from django.contrib.gis import gdal And got: Traceback

Can I store circle and polygon within the same spatially indexed column in postgis?

匆匆过客 提交于 2019-12-10 21:23:43
问题 According to their documentation the spatial objects can be of the following POINT(0 0) LINESTRING(0 0,1 1,1 2) POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)) MULTIPOINT(0 0,1 2) MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4)) MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1))) GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4)) However , there is no circle type, where I can just store a point and its radius. And have the same feature where I

Is the Azimuth on the equator equal to the one not on the equator?

穿精又带淫゛_ 提交于 2019-12-10 20:27:18
问题 I am trying to fully understand the concept of Azimuth and I am encountering some inconsistencies (or maybe it is my error). I show you some examples that do not match, hoping somebody can explain me how this really works. I show the coordinates in EPSG:900913, in PostGIS and using my own JavaScript function. MY FUNCTION /* Difference between the two longitudes */ var dLon = lon2 - lon1; /* Y value */ var y = Math.sin(dLon) * Math.cos(lat2); /* X value */ var x = Math.cos(lat1) * Math.sin

Failed to recognize type of 'location'. It will be treated as String

不打扰是莪最后的温柔 提交于 2019-12-10 19:52:48
问题 I'm trying to use the gem activerecord-postgis-adapter and when i try to execute this code : require 'active-record' require 'pg' require 'active record-postgis-adapter' class Place < ActiveRecord::Base record = Place.find(1) line = record.location puts line.srid end srid is a method of activerecord-postgis-adapter and here i'm trying to display the srid of my geographical column (location) but the console keeps telling me Failed to recognize type of 'location'. It will be treated as String.

Fluent NHibernate automap PostGIS geometry type

巧了我就是萌 提交于 2019-12-10 17:48:14
问题 Given the following model: using NetTopologySuite.Geometries; public class bounding_box { public virtual int id { get; protected set; } public virtual Polygon area { get; set; } } How do I automap the area property to a area geometry(Polygon) column when generating the DB schema using Fluent Nhibernate? Note that I do not care about being able to read / update the geometry column using NHibernate since I will be using GDAL in my code. I know I can do it by implementing a manual override, i.e.

Does phusion passenger use forking, and if so, where to set after_fork config?

一世执手 提交于 2019-12-10 17:43:38
问题 Does phusion passenger use forking? If so, where should I set an after_fork configuration, as recommended by Heroku for unicorn (re: Setting up PostGIS with Rails)? From Heroku's docs: Additionally, if unicorn or any other process forking code is used where the connection is re-established, make sure to override the adapter to postgis as well. For example: # unicorn.rb after_fork do |server, worker| if defined?(ActiveRecord::Base) config = Rails.application.config.database_configuration[Rails

Python: The pysqlite library does not support C extension loading

非 Y 不嫁゛ 提交于 2019-12-10 17:27:02
问题 I'm trying to get Spatialite to work with my django app, however, I've hit the following wall: raise ImproperlyConfigured('The pysqlite library does not support C extension loading. ' django.core.exceptions.ImproperlyConfigured: The pysqlite library does not support C extension loading. Both SQLite and pysqlite must be configured to allow the loading of extensions to use SpatiaLite. make: *** [syncdb] Error 1 Using ubuntu 12.04, I have installed pysqlite using pip within the same user and

ST_DWithin sometimes doesn't use index

我的未来我决定 提交于 2019-12-10 16:09:16
问题 I'm using PostGIS with Postgresql in order to be able to locate entries within some radius by coordinates stored in location column Geometry/Point SRID: 4326 . Here are two queries that I'm experimenting with: First one with distance in meters and use_spheroid=true EXPLAIN ANALYZE SELECT count(*) FROM "cars" WHERE ST_DWithin(location, ST_SetSRID(ST_MakePoint(20, -30), 4326), 105000, true) LIMIT 1000; QUERY PLAN -------------- Limit (cost=11884.28..11884.30 rows=1 width=8) (actual time=18.843.

Postgres - How to automatically call ST_SetSRID(ST_MakePoint(lng, lat), 4326) on inserts?

▼魔方 西西 提交于 2019-12-10 15:38:13
问题 I'm using postGIS, and I'm not very familiar with SQL. I can successfully insert into my markers table as long as I do something like this ( pseudocode!) : 'INSERT INTO markers(created_by, title, description, lat, lng, geography)\ values($1, $2, $3, $4::decimal, $5::decimal, ST_SetSRID(ST_MakePoint($5::decimal, $4::decimal), $6))', [ data.created_by, data.title, data.description, data.lat, data.lng, 4326 ]' As you can see, I am doing ST_SetSRID(ST_MakePoint($5::decimal, $4::decimal), $6) from