4
votes
3answers
319 views

How to create random points in a polygon in PostGIS

I have a polygon layer, and would like to generate random points in each polygon. An initial searching in Google resulted this website which presents a function for this purpose: ...
2
votes
3answers
135 views

Problem with result of query in PostGIS

I run the following query and irrelevant of the point coordinates and radius I always recieve all the records of the table I'm querying. Can anyone point out what the problem could be with this query? ...
2
votes
1answer
252 views

Problem with reading data from PostGIS as KML file using PHP

I am using the following PHP code in order to read data from PostGIS and save it in KML format as a file. When I load the page a document with ".PHP" extension is returned (not .kml) which inside has ...
2
votes
2answers
231 views

Problem in running query on PostGIS using PHP

Would you kindly help me solving this problem. I'm trying to use the PHP code provided here in order to read geo-data from PostGIS. The code seems clear without any problem (also nobody has ...
3
votes
1answer
2k views

Loading Shapefiles into PostGIS using shapefile import/export manager

I am a complete beginner with PostGIS. I've started learning it using the tutorials provided by Boundless. In section 4 of this tutorial where I want to import shapefile in PostGIS, I do not have the ...
4
votes
1answer
907 views

Copy a spatial table from one PostGIS database to another PostGIS database

I have two PostGIS databases on two different servers. The first server is PostGIS 2.0 and the second server is PostGIS 1.5. On the PostGIS 2.0 I have a table "lakes" with MULTIPOLYGON geometry ...
1
vote
1answer
391 views

PostGIS package problem on Ubuntu 12.04.2 LTS

I've started getting an error on Ubuntu when trying to upgrade packages: "Not all updates can be installed Run a partial upgrade, to install as many upgrades as possible" When I run a partial ...
1
vote
1answer
155 views

pgRouting:how to use reverse_cost?

I add a new column, naming it "reverse_cost", and give it the same data in the shape_leng column. But as I run the shortest path algorithm in pgadmin, I got an error message. here's my sql code ...
0
votes
2answers
208 views

How to create a new column to store the length of a linestring in postgis?

I am working with pgRouting, following this nice guide:A Beginner’s Guide to pgRouting I am now in this step:Calculating shortest routes, with these codes below SELECT * FROM shortest_path(' SELECT ...
1
vote
2answers
375 views

Function for Selecting Points in a Polygon

I've been banging on this for a few hours, but since I'm relatively new to PostgreSQL and PostGIS, I can't find the solution. I'm trying to create a stored procedure (function) which will return all ...
3
votes
1answer
542 views

generate height data from DTED maps

I have 16 DTED maps of (1 degree x 1 degree). I have to generate combined height matrix of maximum 4 (1 degree x 1 degree) DTED maps in my C++ application. Can someone suggest to me which open source ...
2
votes
3answers
408 views

ST_Covers: Geography Implementation is not working, Geometry Implementation taking too long

I have a query: (This query uses geographical implementation of ST_Covers function) SELECT ST_Covers(ST_GeoGraphyFromText('MULTIPOLYGON(((179 -89,179 89,-179 89,-179 -89,179 ...
3
votes
2answers
1k views

raster2pgsql part of PostGIS?

Hi GIS Stackoverflow people, I wanted to use the PostGIS functionality raster2pgsql, but I had to discover that the Python function was not installed with my PostGIS installation. Do you know if ...
2
votes
1answer
608 views

How to relate Non-Spatial table to Spatial table in two different Postgis DBs?

I need to relate a Non-spatial table to Spatial table, but both are in different database. Spatial_table(dbname:dist) gid district_name district_code geom Non_Spatial(dbname:census) ID ...
3
votes
0answers
472 views

How can I properly add PostGIS data into MapGuide Maestro?

I am having trouble connecting a PostGIS database to MapGuide Maestro. Actually, I have added the PostGIS data into Maestro, but when I click to validate the layer it shows an error message: ...
4
votes
1answer
329 views

Self-intersecting polygon using extreme values

I have this polygon POLYGON((1.2E-15 1.1E-15,1.31E-15 1.21E-15,-180 -90,180 90,1.2E-15 1.1E-15)) It uses an extreme coordinates like (1.2E-15 1.1E-15) and (180 90) When I call ST_isValidReason, ...
3
votes
2answers
330 views

Invoke PostGIS functions outside of the database? Need to force 3D in GeoDjango

I'm looking to ensure that all geometries saved to the database are three-dimensional. It's easy enough to do with a call to the database, select ST_Force_3D( ST_GeomFromText( blah blah ) ) ...but ...
7
votes
2answers
3k views

Can't import OSM data to PostGIS, permission denied

I use Postgres 9.1 on Xubuntu 11.10. I've created a db 'aus' and user 'aus', granted ALL on the db to the user. Now I try to import the data, and it outputs this error: $ osm2pgsql --create ...
7
votes
2answers
3k views

PostGIS ST_Buffer Radius Help

I am trying to find all points within a five-mile radius of a given point. I have a query like this: SELECT * FROM table WHERE ST_Contains(ST_Buffer(geomFromText('POINT(0 0)', 4326), ?), latlon) I ...
6
votes
2answers
1k views

Creating a spatial PostGIS table as a result of a PostGIS query

When I want to store the results of a spatial query as another PostGIS table, what should I do? I am interested in identifying all residential buildings that fall within a set of parcels: CREATE ...
2
votes
3answers
2k views

Inserting polygon centroids into an additional column in PostGIS

I'm trying to calculate the x and y centroids for a table using ST_Centroid. The documentation says that it returns the geometric center of a geometry. I first made a column X: ALTER TABLE ...
4
votes
1answer
777 views

Geodjango distance between two points appears incorrect

I want to show you something. I am using django+postgis and I am experiencing wrong distance values between two points. This is my model: class Location(models.Model): name = ...
4
votes
2answers
415 views

Does PostGIS not work with psql?

I have a sql script that creates several tables, a trigger, and a trigger function. All the commands work in pgAdmin when I execute them in the "Query" section. My goal is to put all these commands ...
15
votes
4answers
4k views

How to create a circle in PostGIS?

I'm using PostGIS 1.5.2, with geometries in SRID:900913. I need create a circles using a list of points as centre, with a radius of 600 kilometers. I'm using this query: INSERT INTO circles (geom) ( ...
6
votes
1answer
2k views

How to measure length of line accurately?

In postgis 1.5 for the below given query the answer is 1540651.62674101 meters , SELECT ST_Length(ST_GeomFromText('LINESTRING(77.83042478941326 9.98463896136159,78.03469506809812 23.90398909552571 ...
8
votes
2answers
670 views

Splitting polylines using regions with PostGIS

I was wondering if it is possible to split a polyline on polygon boundaries (regions) in PostGIS, the picture below is of what we have at the moment and showing where I need the polylines split: ...