0
votes
2answers
35 views

How can I optimize this point-linking query?

I have the following query, and am wondering how it could be optimised to run faster: WITH gps_nodes_1 AS ( SELECT "NODE_ID", "geog" FROM gps_nodes WHERE ST_Distance("geog",ST_GeogFromText('POINT( ...
2
votes
1answer
314 views

Find nearest neighbours faster in PostGIS

I currently have a query that calculates the number of useful amenities within a certain radius of each town, using OSM data: create table places as select town.name, place, town.way, ( select ...
3
votes
2answers
409 views

PostGIS - ST_Collect but only include POLYGONs not POINTs?

In PostGSI, is there anyway to turn a GEOMETRYCOLLECTION into a MULTIPOLYGON by dropping all non-POLYGONs/non-MULTIPOLYGONs? I'm doing a query that cuts a bunch of geometries (using ST_Intersection) ...
3
votes
0answers
263 views

Shortest distance from pgrouting with cost not being length: optimal solution

I'm using pgrouting shortest_path_astar with a complicated cost function. It gives back the edges, vertices and costs. I would like to get the total distance of this shortest path (i.e., the sum of ...
6
votes
1answer
548 views

PostGIS query vs QGIS filter

I have a PostGIS dataset with around 3 million shapes. I only need to view about 1,500 of these shapes at any given time, but the shapes I need to see depends on which feature is selected in a ...
8
votes
2answers
537 views

How to speed up space partitioning in postgis?

I've a bunch of overlapping polygons and I'm trying to partition the space to avoid having overlapping ones. I think my problem is fairly simple. Using some ESRI product and ...
19
votes
2answers
5k views

Looking for fastest solution for Point in Polygon analysis of 200 million points

Apologies for asking a question that has been asked before -- I've read through answers, and I'm left wondering how to implement the recommendations. I've never used SQL, Python, C, and have only ...
4
votes
2answers
317 views

Fastest way to remove matched points

Hoping someone can see a faster way of doing this, because at the moment I'm averaging 9 hours per run for what I'm trying to do and well basically getting my behind chewed off by the boss :-) The ...
5
votes
1answer
519 views

Speed up pgRouting point_to_id using new <-> operator in PostGIS 2.0.0

The point_to_id function, which assigns a node id to a point based on existing nodes and tolerance, is using a query as follows: SELECT id, the_geom FROM vertices_tmp WHERE ...
1
vote
1answer
482 views

Enhance performance of a join query for mapnik using postgis

I use mapnik to render map with datasources from a postgis database. One query is a join on two table, one with a geometry (a polygon) and the other one with some fields I want to use for rendering. ...
4
votes
3answers
4k views

How to fix performance problem in PostGIS ST_Intersects?

I'm a newbie in postgis and I have a problem in query performance. This my query: SELECT DISTINCT ON (userid) userid ,ST_AsText(position), timestamp FROM table1 WHERE ST_Intersects ( ...
4
votes
3answers
453 views

How to efficiently find points within an elliptical area?

Using PostGIS 2.0.0 I need to filter the results of a function, which returns many POINTs, to find the ones that lie within an elliptical area defined by two points and a distance (all parameters ...
6
votes
1answer
1k views

Performance Gain Through GIST Index for Point in Polygon Query

I have two tables: locations(id,region_id,the_geom) and regions(id,the_geom). For each location point I want to determine the region it is located in: UPDATE locations SET region_id = (SELECT id ...
4
votes
2answers
905 views

Qgis is slow with complex 'postgis query' layer. How to speed up?

I have a postgis layer in Qgis that is a result of a complex query. Every screen update, Qgis runs the Query again and that's slow. Any suggestion on how to speed up? EDIT - Here is the query: ...
6
votes
4answers
3k views

ST_Intersection slow query

I am trying to perform an intersection between two layers: Polyline layer representing some roads (~5500 rows) Polygon layer representing irregularly shaped buffers around various points of interest ...
11
votes
5answers
2k views

Speeding up OpenStreetMap PostGIS querying

I have OpenStreetMap data for the Netherlands loaded into a PostGIS database (PostgreSQL 8.3 / PostGIS 1.3.3) using the osmosis schema. This means all tags are stored in a hstore field. In addition to ...
22
votes
5answers
8k views

Optimizing osm2pgsql imports for OSM data

I'm currently building an instance on EC2 on which to import the entire Planet.osm snapshot of the whole Earth's worth of data for some projects we're working on. I've spun up a large Ubuntu x64 ...
3
votes
2answers
1k views

Postgres/PostGIS Spatial Query Performance Problem

I have a query in Postgres/PostGIS that I am a bit confused about. The spatial intersection happens very fast, ~ 2 seconds for 10,000, but the update takes > 15 seconds for the same number of points. ...