Re: [postgis-users] Reducing the number of points in a GPS track

2012-10-25 Thread Birgit Laggner

Hi Alexandre,

perhaps you could run ST_Simplify in a function with a while loop 
testing over ST_NPoints:


CREATE OR REPLACE FUNCTION simplify_npoints(geometry, integer)
  RETURNS geometry AS
$BODY$

DECLARE
  InGeom alias for $1;
  maxpoints alias for $2;
  npoints integer;
  tolerance float;
  outGeom geometry;

Begin

npoints:=ST_NPoints(InGeom);
outGeom:=InGeom;
tolerance:=0.0;

while npoints  maxpoints loop
  tolerance:=tolerance + 0.001;
  outGeom:=ST_Simplify(InGeom, tolerance);
  npoints:=ST_NPoints(outGeom);
end loop;

return outGeom;

End;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION simplify_npoints(geometry, integer) OWNER TO postgres;



I don't know if it will work (didn't test). And perhaps bigger iteration 
steps would be sufficient, too...


Good luck! Regards,

Birgit.


Am 24.10.2012 14:29, schrieb Alexandre Saunier:

Hello.

I would like to know if some tools are available in PostGIS to
simplify a linestring to a given maximum number of points.
A bit like the simplify,count=... filter in GPSBabel:
http://www.gpsbabel.org/htmldoc-development/filter_simplify.html

ST_Simplify is close to what I need but I don't know in advance what
tolerance to use, only the final maximal number of points.

Is there a way to do that kind of simplification with PostGIS?

Thanks!
Alexandre
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] out of memory error : String too long for converting encoding

2012-10-25 Thread Mahavir Trivedi
 i have 4 GB RAM WINDOWS XP 64-bit
 shared_buffer:512 MB   checkpoint_segment 32
work_mem;5MB

  i wish to import 540 MB tif image  into database postgis 2.0 . without tile .

i got success test.sql file. but error occured when psql -d dbname -f test.sql

error : String is 978678801 byte too long for encoding conversion

pls give any suitable solution

with thanks
mahavir
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] out of memory

2012-10-25 Thread Mahavir Trivedi
 i have 4 GB RAM  WINDOWS XP 64-bit

 shared_buffer:512 MB   checkpoint_segment 32

work_mem;5MB

 i wish to import 540 MB tif image  into database postgis 2.0 . without tile .

i got success test.sql file. but error occured when psql -d dbname -f test.sql

error : String is 978678801 byte too long for encoding conversion

pls give any suitable solution

with thanks
mahavir
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Finding extra points

2012-10-25 Thread Jeff Lake

Greetings..
Is there a function or combination of functions in postGIS-2 that will 
help calculate

points in between 2 given.

I have imported a point shape file containing the National Hurricane 
Center's Watch/Warning breakpoints
when they issue the warnings it contains at least 2 locations from this 
shape file.


is there a way to calculate what points from the shape file would be in 
between the 2 given??


--
*Jeff Lake*
MichiganWxSystem http://www.michiganwxsystem.com
AllisonHouse http://www.allisonhouse.com
GRLevelXStuff http://www.grlevelxstuff.com
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Finding extra points

2012-10-25 Thread Sandro Santilli
On Thu, Oct 25, 2012 at 07:15:20AM -0400, Jeff Lake wrote:
 Greetings..
 Is there a function or combination of functions in postGIS-2 that
 will help calculate
 points in between 2 given.
 
 I have imported a point shape file containing the National Hurricane
 Center's Watch/Warning breakpoints
 when they issue the warnings it contains at least 2 locations from
 this shape file.
 
 is there a way to calculate what points from the shape file would be
 in between the 2 given??

You could draw a line between the two points and find the points which 
are within a given distance from them. See ST_MakeLine and ST_DWithin.

--strk;

 http://www.cartodb.com - Map, analyze and build applications with your data

   ~~ http://strk.keybit.net 

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Reducing the number of points in a GPS track

2012-10-25 Thread Olivier Courtin

On Oct 24, 2012, at 2:29 PM, Alexandre Saunier wrote:

Hi Alex,

 A bit like the simplify,count=... filter in GPSBabel:
 http://www.gpsbabel.org/htmldoc-development/filter_simplify.html
 
 Is there a way to do that kind of simplification with PostGIS?

A way could be to :
 - Compute length of your road with ST_Length
 - Use ST_Line_Interpolate_Point to compute each point on your line
 - Aggregate all points computed in a new simplified line with ST_MakeLine

HTH,

O.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] out of memory

2012-10-25 Thread Bborie Park
You may want to increase your shared_buffer to 25% of your system's
available memory.

You really should tile your raster.

-bborie

On 10/25/2012 02:19 AM, Mahavir Trivedi wrote:
  i have 4 GB RAM  WINDOWS XP 64-bit
 
  shared_buffer:512 MB   checkpoint_segment 32
 
 work_mem;5MB
 
  i wish to import 540 MB tif image  into database postgis 2.0 . without tile .
 
 i got success test.sql file. but error occured when psql -d dbname -f test.sql
 
 error : String is 978678801 byte too long for encoding conversion
 
 pls give any suitable solution
 
 with thanks
 mahavir
 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users
 

-- 
Bborie Park
Programmer
Center for Vectorborne Diseases
UC Davis
530-752-8380
bkp...@ucdavis.edu
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Pg_wrapper error

2012-10-25 Thread Bborie Park
You're probably going to want to call raster2pgsql directly instead of
pg_wrapper.  If the problem is with pg_wrapper, you're better asking a
debian mailing list.

So...

/usr/bin/raster2pgsql MYRASTER MYTABLE | psql -d MYDB

-bborie

On 10/25/2012 08:26 AM, José Pedro Santos wrote:
 
 Dear all, 
 
 I have one problem when I try to load raster to Postgis with the script 
 raster2pgsql from the shell.
 
 I have this error: Error: pg_wrapper: invalid command name
 
 Before this error (I have Postgis version 2.0) I can't use the command 
 (raster2pgsql) in the shell (was not found) but i enable it with this 
 expression: 
 sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/bin/raster2pgsql 
 
 After that the error about pg_wrapper appear. 
 
 Any suggestion? 
 
 Best Regards and thanks,
 Jose Santos
 
 
 
 
 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users
 

-- 
Bborie Park
Programmer
Center for Vectorborne Diseases
UC Davis
530-752-8380
bkp...@ucdavis.edu
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] How to eliminate small gaps produced by ST_union?

2012-10-25 Thread Alexandre Neto
I'm trying to Aggregate\Dissolve a set of adjacent, but not touching
polygons in Postgis. The geometries were created editing the Postgis table
in QGIS created, with snapping and avoid overlap in the layer.

I used ST_Union like this:

SELECT ST_Union(the_geom)
FROM table;

Small gaps similar to lines appear in the result. This happens when the
adjacent polygons do not share the exact same vertices.

[image: Inline image 2]
Is there a way to eliminate this gaps or small angles within Postgis?

I know that v.clean in GRASS can eliminate small angles, and correct
topology, but that would mean I needed to copy the features to GRASS,
correct them and copy it back to Postgis.

Thanks in advance,

Alexandre Neto
image.jpeg___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] How to eliminate small gaps produced by ST_union?

2012-10-25 Thread Sandro Santilli
You may try to construct a topology within PostGIS-2.0, using
a small tolerance, and then get the geometries back. 

--strk;

On Thu, Oct 25, 2012 at 05:54:05PM +0100, Alexandre Neto wrote:
 I'm trying to Aggregate\Dissolve a set of adjacent, but not touching
 polygons in Postgis. The geometries were created editing the Postgis table
 in QGIS created, with snapping and avoid overlap in the layer.
 
 I used ST_Union like this:
 
 SELECT ST_Union(the_geom)
 FROM table;
 
 Small gaps similar to lines appear in the result. This happens when the
 adjacent polygons do not share the exact same vertices.
 
 [image: Inline image 2]
 Is there a way to eliminate this gaps or small angles within Postgis?
 
 I know that v.clean in GRASS can eliminate small angles, and correct
 topology, but that would mean I needed to copy the features to GRASS,
 correct them and copy it back to Postgis.
 
 Thanks in advance,
 
 Alexandre Neto


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] How to eliminate small gaps produced by ST_union?

2012-10-25 Thread pcreso
My impression is that working topologies is slow, especially with large 
datasets - lots of computation involved.

How effective would this be with hundreds of thousands or millions or small 
polygons?

Just running ST_Union() takes hours to days.

Thanks

Brent Wood

--- On Fri, 10/26/12, Sandro Santilli s...@keybit.net wrote:

From: Sandro Santilli s...@keybit.net
Subject: Re: [postgis-users] How to eliminate small gaps produced by ST_union?
To: PostGIS Users Discussion postgis-users@postgis.refractions.net
Date: Friday, October 26, 2012, 6:04 AM

You may try to construct a topology within PostGIS-2.0, using
a small tolerance, and then get the geometries back. 

--strk;

On Thu, Oct 25, 2012 at 05:54:05PM +0100, Alexandre Neto wrote:
 I'm trying to Aggregate\Dissolve a set of adjacent, but not touching
 polygons in Postgis. The geometries were created editing the Postgis table
 in QGIS created, with snapping and avoid overlap in the layer.
 
 I used ST_Union like this:
 
 SELECT ST_Union(the_geom)
 FROM table;
 
 Small gaps similar to lines appear in the result. This happens when the
 adjacent polygons do not share the exact same vertices.
 
 [image: Inline image 2]
 Is there a way to eliminate this gaps or small angles within Postgis?
 
 I know that v.clean in GRASS can eliminate small angles, and correct
 topology, but that would mean I needed to copy the features to GRASS,
 correct them and copy it back to Postgis.
 
 Thanks in advance,
 
 Alexandre Neto


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] How to eliminate small gaps produced by ST_union?

2012-10-25 Thread Bo Victor Thomsen

  
  
Try to use function st_cleanpolygon
  or st_buffer with a radius of 0.0. 
  
  Regards
  Bo Victor Thomsen
  Aestas-GIS
  Denmark
  
  Den 25-10-2012 18:54, Alexandre Neto skrev:

I'm trying toAggregate\Dissolve a set of adjacent,
  but not touching polygons in Postgis.The geometries were created
  editing the Postgis table in QGIS created, with snapping and avoid
  overlap in the layer.
  
  
  I usedST_Union like this:

  
  
  
SELECT ST_Union(the_geom)
FROM table;
  
  
  
  Small gaps similar to lines appear in the result. This
happens when the adjacent polygons do not share the exact
same vertices.

  



Is there a way to eliminate this "gaps" or "small
  angles" within Postgis?


I know that v.clean in GRASS can eliminate small
  angles, and correct topology, but that would mean I needed
  to copy the features to GRASS, correct them and copy it
  back to Postgis.


Thanks in advance,


Alexandre Neto



  
  

  

  
  
  
  
  ___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



  

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] How to eliminate small gaps produced by ST_union?

2012-10-25 Thread Paul Ramsey
If you don't mind altering your other edges somewhat in the process,
dilate/erode will blow those away,

http://blog.opengeo.org/2010/11/22/removing-complexities/

P.

On Thu, Oct 25, 2012 at 10:44 AM, Bo Victor Thomsen
bo.victor.thom...@gmail.com wrote:

 Try to use function st_cleanpolygon or st_buffer with a radius of 0.0.

 Regards
 Bo Victor Thomsen
 Aestas-GIS
 Denmark

 Den 25-10-2012 18:54, Alexandre Neto skrev:

 I'm trying to Aggregate\Dissolve a set of adjacent, but not touching polygons 
 in Postgis. The geometries were created editing the Postgis table in QGIS 
 created, with snapping and avoid overlap in the layer.

 I used ST_Union like this:

 SELECT ST_Union(the_geom)
 FROM table;

 Small gaps similar to lines appear in the result. This happens when the 
 adjacent polygons do not share the exact same vertices.


 Is there a way to eliminate this gaps or small angles within Postgis?

 I know that v.clean in GRASS can eliminate small angles, and correct 
 topology, but that would mean I needed to copy the features to GRASS, correct 
 them and copy it back to Postgis.

 Thanks in advance,

 Alexandre Neto




 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users



 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Finding extra points

2012-10-25 Thread Mike Toews
Sure, use linear referencing functions[1] to interpolate along a line
between the two input points. For example, to find 10 points
in-between 'POINT(2 8)' and 'POINT(3 5)':

select ST_AsText(ST_Line_Interpolate_Point(ST_MakeLine(ST_MakePoint(2,
8), ST_MakePoint(3, 5)), f::float/10))
from generate_series(0,10) as f;

Also, if you have a Z or M coordinate to also interpolate, you can add
it as the third and fourth argument of ST_MakeLine, and you will see
the interpolated result. These extra coordinate dimensions, for
example, could be an attribute quantity from your source point data.
Keep in mind, these are linear interpolation techniques.

-Mike

[1] 
http://postgis.refractions.net/documentation/manual-2.0/reference.html#Linear_Referencing

On 26 October 2012 00:15, Jeff Lake j...@michiganwxsystem.com wrote:
 Greetings..
 Is there a function or combination of functions in postGIS-2 that will help
 calculate
 points in between 2 given.

 I have imported a point shape file containing the National Hurricane
 Center's Watch/Warning breakpoints
 when they issue the warnings it contains at least 2 locations from this
 shape file.

 is there a way to calculate what points from the shape file would be in
 between the 2 given??

 --
 Jeff Lake
 MichiganWxSystem
 AllisonHouse
 GRLevelXStuff

 ___
 postgis-users mailing list
 postgis-users@postgis.refractions.net
 http://postgis.refractions.net/mailman/listinfo/postgis-users

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] PostgreSQL HStore and PostGIS

2012-10-25 Thread Blair Deaver
Hello,

I have a need to design and develop an application which handles a wide
variety of possible variations for a database schema.  I am looking into a
number of options including popular NoSQL databases.  I do keep coming back
to PostgreSQL and PostGIS since I need to deal with geometries in a more
complex manner than either MongoDB or CouchDB Geospatial Indexing offer.

With that said, I have been looking into the new capabilities available
with PostgreSQL HStore
modulehttps://postgres.heroku.com/blog/past/2012/3/14/introducing_keyvalue_data_storage_in_heroku_postgres/
as
a possible alternative to be able to store geometries with PostGIS and tie
additional key/value pairs in a hstore data type column.


   - Can anyone comment on successful or unsuccessful attempts to implement
   such a technology approach integrating PostGIS with HStore?
   - How would one extract data out in such a manner (I suspect a custom
   program would need to be run)?


I do realize HStore is very new on the scene, but curious if this
environment is something that will even work with PostGIS.  Thanks!

Cheers,
Blair
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] PostgreSQL HStore and PostGIS

2012-10-25 Thread Stephen Frost
Blair,

* Blair Deaver (blairdea...@gmail.com) wrote:
 With that said, I have been looking into the new capabilities available
 with PostgreSQL HStore

Uhm..  hstore isn't exactly new.  It's been around since something like
8.0..  It is amusing how people are just now coming to see. :)

- Can anyone comment on successful or unsuccessful attempts to implement
such a technology approach integrating PostGIS with HStore?

I've not heard of anyone putting geometries into hstore's.  It'd be
possible, but realize that to put something into an hstore, it has to be
text.  Also, I don't think you'd be able to create a geometry index over
geometries which are inside of an hstore..  Or at least, if you did, it
might be difficult to actually use.

- How would one extract data out in such a manner (I suspect a custom
program would need to be run)?

Not sure what you mean by this, but you'd need to query the hstore using
the key that you want and then pull the geometry out as text and cast it
to an actual geometry column to use it.  If you just want the data out
in a text format, you'd run asewkt() on the geometry after you pull it
out of the hstore.

Thanks,

Stephen


signature.asc
Description: Digital signature
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] out of memory

2012-10-25 Thread Mahavir Trivedi
  hi i  split the  image (tiff) into 100 X 100 tile .(RASTER IMAGE 500 MB
input )
 but problem occurred when i export  it then output size increase.

(image input size = 1591 X 1446)
(image output size = 1600 X 1450)


can i change blocksize of server ? if yes then how ?
my system XP Windows 64-bit 4 GB RAM

thanks
mahavir
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users