Re: [postgis-users] How to create user-defined C function using a postgis C function

2013-11-13 Thread Peter Tolkewitz
Hello Sandro,   works perfect now, thank you! The solution for PostGIS2.0.x was to compile with   > cc -llwgeom -I/usr/include/pgsql/server -fpic -shared -o libtest.so test.c   and define the following function within test.c:   void lwgeom_init_allocators(void) {     lwgeom_install_default_allocato

Re: [postgis-users] Grid of points inside Polygon

2013-11-13 Thread James David Smith
Hey Remi, Thanks for your reply. So in your mind you think we should have a database of say 300 polygons, and then we run a command like this right? SELECT ST_Collect(st_setsrid(ST_POINT(x,y),27700)) FROM generate_series(53320::int, 667380::int,20) as x, generate_series(7780::int, 1226580::int,20

[postgis-users] database backup with postgis extension

2013-11-13 Thread Paulo Frias
Hi all, I'm trying to backup my database (which have postgis extension) into a new one with pg_dump. When I do the pg_restore it gave me a lot of errors and the new created database was empty. Can anyone please help me to find the solution for this? Thanks, P. ___

Re: [postgis-users] Grid of points inside Polygon

2013-11-13 Thread Rémi Cura
This would be an improvement but still non efficient. you have 2 possibilities, supposing that what you want is points 20 meter spaced in all road_buf : either you compute for each road_buffer the points inside, one road at a time ( figuratively ). This means you write a function which generate

Re: [postgis-users] database backup with postgis extension

2013-11-13 Thread Devrim GÜNDÜZ
Hi, On Wed, 2013-11-13 at 11:39 +, Paulo Frias wrote: > I'm trying to backup my database (which have postgis extension) into a > new one with pg_dump. > When I do the pg_restore it gave me a lot of errors and the new > created database was empty. What are the errors? Did you install PostGIS

Re: [postgis-users] Grid of points inside Polygon

2013-11-13 Thread James David Smith
Hi Remi, Thanks so much for this detailed response. Your idea about creating the lines and the only storing where they intersect and are within the polygons is a great idea. I'm going to give that a go now. Thanks again, James On 13 November 2013 11:41, Rémi Cura wrote: > This would be an impr

Re: [postgis-users] Grid of points inside Polygon

2013-11-13 Thread James David Smith
Hi Remi, Apologies. One more thing which I am not sure about. We need the final grid of points that we make to be multiples of 20. For example: 53320, 7780 = Yes 53323, 7780 = No 53320, 7794 = No 53321, 7754 = No That is why in the original function that we wrote, we put the numbers in as below

Re: [postgis-users] database backup with postgis extension

2013-11-13 Thread Paulo Frias
The errors are: pg_restore: [archiver (db)] Error from TOC entry 3978; 1259 35665 INDEX intertidal_line_apt_geom_gist postgres pg_restore: [archiver (db)] could not execute query: ERROR: relation "intertidal_line_apt_geom_gist" already exists and the same for the other data which have geometry.

Re: [postgis-users] database backup with postgis extension

2013-11-13 Thread Paulo Frias
Thanks.. On 13 November 2013 12:34, Paulo Frias wrote: > It works.. ;) > > > > On 13 November 2013 12:06, Paulo Frias wrote: > >> The errors are: >> >> pg_restore: [archiver (db)] Error from TOC entry 3978; 1259 35665 INDEX >> intertidal_line_apt_geom_gist postgres >> pg_restore: [archiver (db

Re: [postgis-users] database backup with postgis extension

2013-11-13 Thread Paulo Frias
It works.. ;) On 13 November 2013 12:06, Paulo Frias wrote: > The errors are: > > pg_restore: [archiver (db)] Error from TOC entry 3978; 1259 35665 INDEX > intertidal_line_apt_geom_gist postgres > pg_restore: [archiver (db)] could not execute query: ERROR: relation > "intertidal_line_apt_geom_

Re: [postgis-users] Grid of points inside Polygon

2013-11-13 Thread Rémi Cura
Using the lines you exactly do the same as with points. The lines will be spaced exactly by 20 meters, end and start being exactly on the 20 meters grid, line being either perfectly veritcla or perfectly horizontal. So intersections are guaranteed to be on the 20 meter grid, because this is the def

Re: [postgis-users] Grid of points inside Polygon

2013-11-13 Thread Pierre Racine
You can use ST_PixelAsCentroids(ST_AsRaster()) to generate a regular grid of points inside a polygon. Pierre > -Original Message- > From: postgis-users-boun...@lists.osgeo.org [mailto:postgis-users- > boun...@lists.osgeo.org] On Behalf Of Rémi Cura > Sent: Wednesday, November 13, 2013 6:

Re: [postgis-users] Grid of points inside Polygon

2013-11-13 Thread James David Smith
Hey Remi, I don't quite get what the query you gave does to be honest. But working with some of the ideas and notions you gave me I have put the below together. The final bit of the code is the key query. The tables of NS and EW lines were done very quickly. Nice. But now doing the 'intersects wit

Re: [postgis-users] Grid of points inside Polygon

2013-11-13 Thread Rémi Cura
All lines should be in one table, you can add a column to differentiate between line going SN and EW, this is what the query I wrote does. Not changing your code much, it gives for the line table : CREATE TABLE all_lines tablespace jamestabs AS ( SELECT st_setsrid(st_makeline(st_makepoint(x, 7780