PostGIS

Varnish ban is added but old object is returned

可紊 提交于 2021-02-08 06:32:49
问题 I'm using varnish in front of a tile server to cache mapbox tiles. To remove old tiles, I intended to use bans to effectively remove a large number of cached tiles. My problem is that varnish still uses the cached objects (at least the age in the response indicates this) and doesn't contact the backend. I'm first requesting http://varnish/5/3/4.pbf, then adding a ban with curl -X BAN -H 'X-Purge-Regex: 5/3/4.pbf' varnish or alternatively varnishadm and then ban obj.http.url ~ 5/3/4.pbf and

GeoDjango distance of related model

浪尽此生 提交于 2021-02-07 19:44:48
问题 I'm trying to return a queryset with distances from a related model. models.py (simplified) class Store(models.Model): geopoint = models.PointField(srid=4326) objects = models.GeoManager() class HashTag(models.Model): tag = models.CharField(max_length=100) class Label(models.Model): hashtags = models.ManyToManyField(HashTag) store = models.ForeignKey(Store) What I need to return are the Label objects which have a certain tag/tags ordered by distance from a given point. The Labels can be found

GIS/Gdal/OSGeos Import error in django on Windows

末鹿安然 提交于 2021-02-07 12:51:48
问题 I am trying this from hours now and I couldn't get get it solved. I am using this link to setup GeoDjango on Windows. I am getting following error message and I have no clue what to do. All the environment variables are set in Windows and I am able to import with from osgeo import gdal successfully in python terminal as import gdal is deprecated. In Postgresql database I have all extensions available as required like address_standardizer , fuzzystrmatch , ogr_fdw , pgrouting , plpgsql ,

GIS/Gdal/OSGeos Import error in django on Windows

有些话、适合烂在心里 提交于 2021-02-07 12:51:16
问题 I am trying this from hours now and I couldn't get get it solved. I am using this link to setup GeoDjango on Windows. I am getting following error message and I have no clue what to do. All the environment variables are set in Windows and I am able to import with from osgeo import gdal successfully in python terminal as import gdal is deprecated. In Postgresql database I have all extensions available as required like address_standardizer , fuzzystrmatch , ogr_fdw , pgrouting , plpgsql ,

missing libgeos_c.so on OSX

我只是一个虾纸丫 提交于 2021-02-06 10:07:02
问题 I am trying to install Postgis in order to use GeoDjango on OSX. For this, I first uninstalled postgres completely, then I installed everything following the GeoDjango documentation: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#homebrew I did the following: brew update brew upgrade brew install postgresql brew install postgis brew install gdal brew install libgeoip When I run my Django project, I get the following error: OSError at / dlopen(/usr/local/lib/libgeos_c.so, 6):

missing libgeos_c.so on OSX

走远了吗. 提交于 2021-02-06 10:03:52
问题 I am trying to install Postgis in order to use GeoDjango on OSX. For this, I first uninstalled postgres completely, then I installed everything following the GeoDjango documentation: https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#homebrew I did the following: brew update brew upgrade brew install postgresql brew install postgis brew install gdal brew install libgeoip When I run my Django project, I get the following error: OSError at / dlopen(/usr/local/lib/libgeos_c.so, 6):

Why does st_intersection return non-polygons?

南笙酒味 提交于 2021-01-29 06:08:52
问题 I have two polygon layers. I want to run st_intersection on them, to give the result of the areas where they overlap as a new layer. The new layer should contain the attributes from both input layers. I found this image which seems to illustrate my desired end results. My two input layers are both polygons: SELECT st_geometrytype(geom), COUNT(*) FROM a GROUP BY st_geometrytype(geom) -- Result is 1368 st_polygons SELECT st_geometrytype(geom), COUNT(*) FROM b GROUP BY st_geometrytype(geom) --

How to add 2 points with distance between them (SRID = 32636)?

£可爱£侵袭症+ 提交于 2021-01-28 11:36:08
问题 I'm using python 3.6 and postgres DB I have a table name: test_table with the following fields: name ( text ), geo ( geometry ) the srid of geo field is 32636 I want to write a python function which get point X (wkt) and return point Y with distance of 10 meters between the points. i.e: The X and Y are in WKT format How can I calculate the point Y with X is the input ? It seems that I can't use euclidean distance , because the srid is 32636 so how can I do it ? 回答1: You could cast your

Postgis + boost::geometry + C++

荒凉一梦 提交于 2021-01-28 04:41:24
问题 I have the following wtk: POLYGON((0 0, 10 0, 10 11, 11 10, 0 10)) In boost::geometry we can get this polygon representation using boost::geometry::dsv(polygon," "," "," "); How I can apply postgis st_makevalid function to a boost::geometry polygon? I suppose it something like: #include "libpq/libpq-fs.h" #include "../libpq-fe.h" . . . std::string geom = "POLYGON" + boost::geometry::dsv(multipoly," "," "," "); res = PQexecParams(conn, "SELECT st_makevalid(geom) FROM .... I do not want to

PostgreSQL/PostGIS - PQexecParams - wrong element type

折月煮酒 提交于 2021-01-27 17:26:58
问题 I have this code. const char * q = "INSERT INTO test_raster (raw_data) VALUES (ST_SetValues(ST_AddBand(ST_MakeEmptyRaster(2, 2, -180, -90, 180, -90, 0, 0, 4326), 1, '8BUI', 0, 0), 1, 1, 1, $1::double precision[][]))"; double tmp[2][2] = { {0, 125}, {45, 255} }; const char *values[1] = { (char *)&tmp }; int lengths[1] = { 4*sizeof(double) }; int binary[1] = { 1 }; PGresult *rs = PQexecParams(psql, q, 1, NULL, values, lengths, binary, 0); auto stat = PQresultStatus(rs); printf("%s",