PostGIS is an extension for the PostgreSQL object-relational database that adds support for geographic objects.

learn more… | top users | synonyms

0
votes
2answers
50 views

Count number of points within certain ranges from a set of points

I have the following, which gives me the number of customers within 10000 meters of any store location: SELECT COUNT(*) as customer_count FROM customer_table c WHERE EXISTS( SELECT 1 FROM ...
2
votes
1answer
100 views

Find number of points within certain radius of a set of points

I have two tables. One is a list of stores (with lat/long). The other is a list of customer addresses (with lat/long). What I want is a query that will return the number of customers within a certain ...
0
votes
0answers
53 views

KNN combined with other clauses

I have a table with columns:- wkb_geometry (geometry), road_id character varying, year INTEGER The data set has multiples of road_id across many years. I want to get the nearest 10 values to a ...
2
votes
0answers
43 views

How do make ST_Split ready for QGIS?

In my recent QGIS project I need to split polygons (table/layer "pol") by both closed and non-closed linestrings (table/layer "lin"). I've tried the following SQL queries. CREATE VIEW split_pol AS ...
1
vote
0answers
12 views

PostGIS TIGER reverse_geocode() returns state only

I have a clean install of PostGIS 2.1 in Postgres 9.3 on Ubuntu, using apt-get and postgres extensions. Ran the data loading scripts from here. normalize_address works well, but geocode returns no ...
0
votes
1answer
62 views

Error with TileMill and OpenStreetMap Carto project

I have been trying to load the OpenStreetMap carto project in order to export tiles for use on our in house GIS Server. I have followed all the instructions up to loading the osm xml into postGIS and ...
1
vote
0answers
36 views

Export to shapefile error in QGIS from POSTGIS table

I am attempting to export a postGIS layer to a shapefile in QGIS 2.6.1 Brighton. The table has 244,674 rows. The data displays perfectly well in QGIS but when I attempt to export to shapefile I get ...
1
vote
1answer
55 views

Running spatial query on huge table [duplicate]

I've got two tables conatining geometry: 1 containing big polygon's (regions, srid=4326) and another containing smaller polygon's (pand, srid=28992, containg ~9.9milion rows) By using one of the big ...
1
vote
0answers
38 views

How can I identify regions with some points as centers? [closed]

I have a Postgres database of entire U.S. zipcodes and their lat/long data. My requirement is to divide these zipcodes into non overlapping regions. All regions have some center zipcode. All ...
0
votes
0answers
19 views

Tilestache - Mismatch between the coordinates present in the PostgreSQL/PostGIS and those returned by PostGeoJSON provider

This is the relevant bit my Tilestache config, "points-of-interest": { "provider": { "class": "TileStache.Goodies.Providers.PostGeoJSON.Provider", "kwargs": { "dsn": ...
1
vote
0answers
48 views

How to update the OSM data in a PGRouting Database built with osm2pgrouting?

I'm using a PGRouting database originally built with osm2pgrouting from a *.osm file downloaded from Mapzen. If I want to update the OSM data in that database, ie. re-build my PGRouting Database, ...
0
votes
1answer
38 views

SQL query giving error in pgrouting?

SQL error: ERROR: function point(numeric) does not exist LINE 4: (ST_GeometryFromText(Point(53.34972 -6.26025)), 4326), 1000) ^ HINT: No function matches the ...
0
votes
0answers
19 views

Get addresses from TIGER geocoder in polygon

I have the TIGER geocoder installed, setup and working in POSTGIS. I also see the reverse geocoder lets me get an address from a point on the map. But now I want to provide a polygon and get all the ...
0
votes
0answers
21 views

How to share constraints between tables in a PostGIS database?

I have a PostGIS (v2.1) database that contains several tables, each representing a raster that I loaded by calling raster2pgsql. I'd like to ensure that the rasters contained by these tables have the ...
0
votes
0answers
23 views

GDAL Python and postgis raster?

I'd like to create a postgis raster using GDAL and python. I can get the driver easily: drv = gdal.GetDriverByName("PostGISRaster") But how can I create a new raster table? I can't find any ...
0
votes
0answers
42 views

Raising height of a certain part of choropleth

I have a working choropleth map which shows number of patients in a certain coloured area. I want to raise the height of the specific area according to the patient count. The variable height is equal ...
1
vote
0answers
48 views

Loaded OSM Data into PostGIS Database. Cannot view in ArcMap “The coordinate system identifier is invalid”

I loaded OSM File for Pennsylvania into a PostGIS Database in PostgreSQL using osm2pgsql. Everything seemed to go without a hitch until I finally connected to the Database in arcCatalog and tried to ...
1
vote
1answer
48 views

How to concatenate values from postgis table which have the same id into a new column? [closed]

I have the following table in postgres-9.3 postgis 2.1. (geom values is too long , I cut to make it short in below table): id | name | geom ------------------------- 12 | A | "01030000000" 12 | ...
0
votes
0answers
10 views

postgis update query equivalent for shapefile geowithin update using QGIS [duplicate]

Using QGIS I can use the field calculator to update one point layer based on the point falling within another layer's polygon using geomwithin('water','water_id'). What is an equivalent update query ...
0
votes
1answer
50 views

Creating geometry from lat/lon in table using PostGIS?

I have a table with over 800,000 records including a lat and long column. The data source did not create geometries, so I was looking around how to do this. I know there's ST_MakePoint(x,y,SRID) but ...
2
votes
3answers
144 views

How to get India OSM map offline in geoserver which looks similar to online OSM map?

I need to OSM map of India having same look and feel as of Online OSM map. I have done following steps for the same : I have downloaded India map OSM data from below link : ...
3
votes
2answers
119 views

Creating polygons from line segments using PostgreSQL and PostGIS

Is there a PostGIS function that creates polygons from multiple line segments? I want to convert the pictured thirteen lines to four polygons. All lines belong to the table "boundary" (gid, geom). ...
1
vote
0answers
23 views

How to fix broken geometry after joining features in PostGIS

I have a PostGIS layer I'm serving over GeoServer. It looks like this. Im using the PostGIS query to get a new layer with some grouped features: SELECT id, name, st_union(st_buffer(geom, ...
1
vote
1answer
104 views

PyQGIS - load PostGIS layer as editable

I can load a PostGIS layer on QGIS' map canvas but "Toggle Editing" button comes "inactive". How can I load vector layer as editable? The code given below loads PostGIS layer on map canvas & ...
0
votes
0answers
44 views

Perfom SQL queries in Python and process the result

I query column names from a PostGIS table with following Python code: colnames = [] sql_getcolumns = "select column_name from information_schema.columns where table_name='shp2py';" ...
2
votes
1answer
46 views

How to know if two geometric figures are approximately equal?

I would like to know how to determine if two geometric figures (the_geom) are approximately equals. By the way, I'm working with Python, PostgreSQL and Postgis I have the following geometries: ...
1
vote
1answer
41 views

How to view a postgis raster query in QGIS

I have successfully loaded a large number of .asc images (>2800 200x200 tiles) into a Postgres table with PostGIS 2.1 support. The new table appears in QGIS's DB Manager and I can add the whole image ...
3
votes
1answer
60 views

ogr2ogr postgres import: check if dataset exists

I have a PostGIS database which I update daily with ogr2ogr using CSV files. This works great. Is there a way to check whether the actual value of a column already exists in the table (e.g. ...
1
vote
1answer
21 views

Why prj2epsg cannot resolve PostGIS SRText?

In many places I have seen people referring to http://prj2epsg.org (here, here). I have used this service too, however, the service cannot uniquely identify an EPSG code alway. I understand that it ...
0
votes
0answers
23 views

Branching factor in River system?

I would like to find the branching factor for a river system. I have tried dissolving it then trying to find the branching factor but I'm not to sure how. So I have it from west to east like it ...
1
vote
1answer
41 views

Creating geodjango model with geometry field that can accept different projections

I am working on web application with GeoDjango and within the model (db table) RoadAxis I have geometry field or more precisely LineStringField where I need to store different polylines (road axis) ...
0
votes
1answer
42 views

How to join a WFS layer to a table in OpenLayers

So I have to bring up this old question How to join a WFS layer to a stand-alone table in OpenLayers I recently have to get this working, I have to join a WFS layer data from GeoServer using postgis ...
0
votes
1answer
43 views

Insert rows into CartoDB from code

I have a simple web page where i show my cartoDB map and a dataset. I want to know if there is any way to insert new rows into my cartoDB dataset from code, so external users can add points to the map ...
2
votes
1answer
77 views

How to cluster points into clusters of a maximum diameter in PostGIS?

I'm working with transit stops in GTFS. I want to group together stops (N~8000 for a medium sized agency in the USA) which are proximately related in order to reduce the number of dimensions but also ...
1
vote
0answers
90 views

Import shapefiles into PostGIS using Python with psycopg2

I want to import shapefiles to PostGIS using Python with arcpy & psycopg2 to connect to PostGIS. I don't want to use the existing shapefile loader nor ogr, just write my own import tool. My steps ...
0
votes
1answer
77 views

Can't import shapefile to PostGIS

Sorry if my question is double post with the previous. I have tried to browse but I think I still can't find the solution. I am using postgresql 9.4.1 and postgis 2.1(pg 94) and also qgis 2.4.0. All ...
1
vote
1answer
65 views

Speeding Up pgr_dijkstra using bounding box in PostGis2.0

I'm using PostGIS for the first time to calculate distances between two points, for a driving school booking system I am working on. I have loaded in all of the maps for Australia, but the query I ...
1
vote
0answers
33 views

suitable column Data-type for geojson data storage and processign in PostGis

I have a MySQL table with 2 columns, id, a unique geometry id, and GeoJSON stored as a varchar, eg, {"type": "Point", "coordinates": [116.4, 45.2, 11.1]} ...
1
vote
1answer
54 views

How do I create a spatial filter on a layer?

I have a layer that draws points in a PostgreSQL (PostGIS) database. The problem is, all points in the table are being drawn. I want to limit the points drawn to a spatial query. How do I limit the ...
0
votes
1answer
40 views

Problem with importing WKT to PostGIS

I'm trying to import WKT (http://polygons.openstreetmap.fr/get_wkt.py?id=2413177&params=0 - boundary of one of districts of Łódź) into PostGIS database and convert it to geometry. I've created ...
1
vote
0answers
26 views

set Default projection in postgis table

I've set the SRID 4326 for a table having geometry column, but when i insert a geometry without SRID, i get an error because no SRID specified is interpreted as -1 or 0, so how i can set a default ...
1
vote
1answer
91 views

How to create dissolved buffers in QGIS with PostgreSQL/PostGIS?

Creating a dynamic buffer in QGIS I use the following query: CREATE VIEW buffer40units AS SELECT gid, st_buffer(geom,40)::geometry(polygon, 31492) AS geom FROM point; Now I want to dissolve ...
2
votes
0answers
38 views

ST_Buffer with segment AND endcap parameters

Making a QGis plugin that buffers a line and I want to declare a high number of segments and a flat endcap. ST_Buffer(geom, 40, 25, 'endcap=flat') This doesn't work with both parameters entered, ...
2
votes
2answers
128 views

Map-matching GPS points to the road network!

I am quite a newbie in Postgres and Postgis so please be simple and clear :) I am trying to do a simple map-matching (or path-inference if you wish) of some GPS points. I am using postgres(postgis). ...
0
votes
1answer
43 views

Displaying KML data with a user selection

I want to web map some historical cyclones data which are now in KML files, file/year. So I want the user to select a year from a button and the KML files will be displayed on interactive map). I ...
3
votes
1answer
74 views

Create common vertexes between shared polygon boundaries in PostGis?

Given two polygon tables L1 (blue) and L2 (red) that share a common boundary but different amount of vertexes, how can one make the shared boundary identical (they should share the same vertexes) ? ...
2
votes
2answers
112 views

Can't connect to foreign SQL Server table from PosgreSQL using OGR_FDW

I'm using Windows 7, with PostgreSQL 9.3.6 installed and PostGIS 2.1.5. While I wish I could get everything into PostgreSQL, I can't and need to connect to another server running SQL Server. I need to ...
0
votes
1answer
38 views

QGIS GPS not editing offline database

I have a set of layers from PostGIS that I have converted to offline. I am attempting to edit them via GPS. If the layer is point data, then I can add in that data without issue. However when I go to ...
0
votes
0answers
26 views

PostGis - ST_AsRaster returning raster smaller than reference raster

I am trying to convert a point geometry to a raster using a reference raster: SELECT ST_AsRaster(my_points, ref_raster) FROM my_table This works fine except it is only returning a subset of the ...
1
vote
1answer
44 views

PostGIS: Is it possible to identify overlapping polygons in the same layer using their geomteries?

I have a single table containing the geometries of ~3 million polygons and I am looking to calculate the number of polygons that overlap with another. I know that you are able to do this in QGIS ...