Re: [postgis-users] Programmatically generate maps zoomed to extent of shapes?

2010-09-23 Thread Nicklas Avén
I think it looks like a job for mapserver to produce the images. then you can 
decide both output extent on the fly and decide the input extent by a query or 
a bounding box or whatever.
but that will just give you images. How to make the layout I don't know. 
/Nicklas2010-09-23 John Poole wrote:

I'm preparing walk lists for a campaign which contains a table of
addresses, about 35 to a page on 8.5 x 11 paper. I have the
addresses tied into a postgis database with roads and assessor's
parcels, so for a given page, I can get a handle on the IDs of the
associated shapes.

What I'm wondering is would it be possible to generate a map in SVG or
PNG/TIFF that would measure 8 x 10.5 and be zoomed to a level that
would just include the most opposite parcels. I gather I could define
a shape that is all inclusive of the list of shapes for a particular
page, but can I then take the coordinates or whatever information
derived and submit it to a renderer which then creates a zoomed image
of defined dpi (if PNG or TIFF) that would be a representation of a
view of all parcels.

For example, I have a list of addresses, being 35 representing 3 1/2
city blocks:
 200 Main Street
 204  
 ...
 535  

All of the above addresses tie into specific shape IDs in postgis.

I'd like to have a map which would then display a zoomed level so that
the parcel of 200 is leftmost and parcel 535 is rightmost of the
image. This map would be generated on the fly without human
intervention, in other words generated by script.

I'm getting my feet wet with various renderers, but have not seen any
that might be manipulated or controlled programmatically so that mapes
could be generated by scripting.

What I am envisioning is having a map of the parcels on the back side
of a previous page representing an view of the current page. So, if
page three (3) contains the above addresses, the back side of page two
(2)would have the map showing all parcels tied to the addresses of
page three. That way someone looking at the list on page three could
hold up the back side of page 2 in a binder and view a map zoomed to
the right level containing all the parcels referenced on page three.
 I'd prefer to use my own data from postgis, I think this kind of
generation would be possible with the Google maps API and possibly
creating a container shape that bounds all the shapes from the list.

It would be helpful to learn of any renderers, especially ones that
expose an application interface.

(Hmmm.. now I'm thinking I could generate a large image file of
certain sectors and if I could tie the pixels, I could use ImageMagick
to slice and dice what I need.)

Any rate, this is a wild inquiry which might garner some attention and
generate some responses about renderers, especially ones with exposed
APIs so they can be manipulated programmatically.

-- 
John L. Poole

P.O. Box 6566
Napa, CA 94581-6566
707-812-1323

jlpool...@gmail.com
___
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] Difference between ST_Intersects and operator

2010-09-23 Thread Andreas Forø Tollefsen
Ok. I see. But why is the results so different. When using ST_Intersects the
result is correct, while using  it seems there is no order in which vector
grid cells it selects. It is not the cells intersecting with the country
polygon, but rather a mesh of random cells also outside of the country
polygons.

2010/9/22 Paragon Corporation l...@pcorp.us

   does a bounding box intersects check where as ST_Intersects does a
 more intensive actual geometry intersect check.  Which is why its slower.



  --
 *From:* postgis-users-boun...@postgis.refractions.net [mailto:
 postgis-users-boun...@postgis.refractions.net] *On Behalf Of *Andreas Forø
 Tollefsen
 *Sent:* Wednesday, September 22, 2010 11:00 AM
 *To:* PostGIS Users Discussion
 *Subject:* [postgis-users] Difference between ST_Intersects and 
 operator

 Hi all.
 I am working on a huge vector grid project where i need to intersect
 country polygon data and vector grid cells.
 For this i need to first select the grid cells which intersects with the
 country polygons.

 SELECT DISTINCT testgrid.gid, xcoord, ycoord, cell INTO testgrid2 FROM
 testgrid, cshaperef WHERE ST_Intersects(cshaperef.the_geom,
 testgrid.cell)=true

 I tried both the ST_Intersects and the  operator, but i cannot really
 understand the difference.
 After looking at my results the ST_Intersects gave exactly the cells which
 intersected with the country polygons, while the  gave many additional
 cells.
 Another interesting observation is the the  is way faster than the
 ST_Intersects which in my case 188 polygons and 212000 cells takes a lot of
 time.

 Could anyone please elaborate on the difference?


 ___
 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] Difference between ST_Intersects and operator

2010-09-23 Thread Nicklas Avén
As said before the  operator only calculates which bounding boxes that
intersects. The bounding box is the smallest box that can contain the
geometry. It is a box made of the maximum and minimum x any y values
found in the geometry. 

So, when the bounding boxes intersect it says nothing about if the
geometries inside the box intersects. But it is a fast way to sort away
geometries that NOT intersect since intersections between geometries is
impossible if the bounding boxes doesn't intersect.

The bounding boxes is also possible to structure in an index. That makes
it really fast to find intersection between bounding boxes if you have a
working index on the geometries.

This is what ST_Intersects (and a lot of other functions) does. First it
finds intersecting bounding boxes with help of the index if present
(this is done with the  operator inside ST_Intersects function). Then
it checks the real geometries inside the boxes if they really
intersects. 

HTH

Nicklas



On Thu, 2010-09-23 at 09:08 +0200, Andreas Forø Tollefsen wrote:
 Ok. I see. But why is the results so different. When using
 ST_Intersects the result is correct, while using  it seems there is
 no order in which vector grid cells it selects. It is not the cells
 intersecting with the country polygon, but rather a mesh of random
 cells also outside of the country polygons.
 
 2010/9/22 Paragon Corporation l...@pcorp.us
  does a bounding box intersects check where as ST_Intersects
 does a more intensive actual geometry intersect check.  Which
 is why its slower.
  
  
 
 
 __
 From: postgis-users-boun...@postgis.refractions.net
 [mailto:postgis-users-boun...@postgis.refractions.net] On
 Behalf Of Andreas Forø Tollefsen
 Sent: Wednesday, September 22, 2010 11:00 AM
 To: PostGIS Users Discussion
 Subject: [postgis-users] Difference between ST_Intersects and
  operator
 
 
 
 
 Hi all. 
 I am working on a huge vector grid project where i need to
 intersect country polygon data and vector grid cells.
 For this i need to first select the grid cells which
 intersects with the country polygons.
 
 
 SELECT DISTINCT testgrid.gid, xcoord, ycoord, cell INTO
 testgrid2 FROM testgrid, cshaperef WHERE
 ST_Intersects(cshaperef.the_geom, testgrid.cell)=true
 
 
 I tried both the ST_Intersects and the  operator, but i
 cannot really understand the difference.
 After looking at my results the ST_Intersects gave exactly the
 cells which intersected with the country polygons, while the
  gave many additional cells.
 Another interesting observation is the the  is way faster
 than the ST_Intersects which in my case 188 polygons and
 212000 cells takes a lot of time.
 
 
 Could anyone please elaborate on the difference?
 
 
 
 ___
 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


[postgis-users] repeating points filtering

2010-09-23 Thread Nicholas I
Hi,

I have a table called locations, which contains the city name's and
landmarks.

 some of the location name get's repeated but they all have a different
lat,lon.
 some of the locations are very near by like within 2km.

I want to eliminate the locations that are very close by having the same
name. (only those have the same name).
distinct give's me unique record's.

does buffer help me to solve the problem. i am not able to understand... i
am confused which one to use. whether to use, buffer, distance or dwitin.

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


[postgis-users] Geography type

2010-09-23 Thread Gastón Lucero

Sorry for my english.

I would like to know the use of the geographic data type.

Actually i have to work in represent spherical data.

Thanks.

Gaston Lucero
www.sitrack.com

Disclaimer:

This email and any attachments thereof may contain confidential, privileged, 
proprietary, or otherwise private information. This email is intended solely 
for the use of the individual to whom it is addressed. If you are not the 
intended recipient of the email and its attachments please inform the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose or store or copy the information in any way and delete this e-mail 
and its attachments from your system. Any views or opinions expressed are 
solely those of the author.
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] problem to obtain intersection: TopologyException

2010-09-23 Thread salas
Hi,

I have a table 'municipio' with a geometric column (the_geom). I want to get a 
view with the resultant of the interception between the the_geom column and a 
polygon.

The query: 
--
SELECT ST_Dump(ST_Intersection(the_geom, 
GeomFromText('MULTIPOLYGON(((177056.442675 283157.030268, 283157.030268 
192559.320783, 192559.320783 293446.551137, 177056.442675 293446.551137, 
177056.442675 283157.030268)))',2085)))
FROM municipio
WHERE the_geom IS NOT NULL 
  AND ST_Intersects(the_geom, GeomFromText('MULTIPOLYGON(((177056.442675 
283157.030268, 283157.030268 192559.320783, 192559.320783 293446.551137, 
177056.442675 293446.551137, 177056.442675 283157.030268)))',2085)) = TRUE

return an error:


NOTICE:  TopologyException: found non-noded intersection between 178970 311240, 
178977 311221 and 178976 311224, 178971 311238 178972 311234


ERROR:  GEOS Intersection() threw an error!

** Error **

ERROR: GEOS Intersection() threw an error!
SQL state: XX000


What's the problem 
The WHERE statemente ((the_geom, GeomFromText( ...) ) ensure the intersection

Best regards, Salas

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


Re: [postgis-users] Geography type

2010-09-23 Thread Mike Toews
You need PostGIS version 1.5.x and you can read about the geography type here:
http://postgis.refractions.net/documentation/manual-1.5/ch04.html#PostGIS_Geography

and see supported functions here:
http://postgis.refractions.net/documentation/manual-1.5/ch08.html#PostGIS_GeographyFunctions

-Mike

On 23 September 2010 06:31, Gastón Lucero gaston.luc...@sitrack.com wrote:

 Sorry for my english.

 I would like to know the use of the geographic data type.

 Actually i have to work in represent spherical data.

 Thanks.

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


[postgis-users] Using both and ST_Intersects in a query

2010-09-23 Thread Andrea Peri 2007

 Hi,

reading the thread Difference between ST_Intersects and  operator 

If I understand exactly

this mean that a query filter like this:

select ...
from
  table1 as a,
  table2 as b
where
(  (a.geom  b.geom)  (ST_Intersects(a.geom,b.geom)=true ) )

if faster than a query without the 
like this:

select ...
from
  table1 as a,
  table2 as b
where
(  ST_Intersects(a.geom,b.geom)=true  )

I understand correctly ?

Thx,

Andrea Peri.

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


Re: [postgis-users] Using both and ST_Intersects in a query

2010-09-23 Thread Vincent Picavet
Hi,

 this mean that a query filter like this:
 
 select ...
 from
table1 as a,
table2 as b
 where
 (  (a.geom  b.geom)  (ST_Intersects(a.geom,b.geom)=true ) )
 
 if faster than a query without the 
 like this:
 
 select ...
 from
table1 as a,
table2 as b
 where
 (  ST_Intersects(a.geom,b.geom)=true  )

This would be true if ST_Intersects would'nt already include a bounding box 
intersection step before trying the real intersection algorithm.
The magic is already in PostGIS :)

But you can try the difference with _st_intersects, which only does the 
geometric intersection without the bbox comparison first.

Vincent

-- 
Vincent Picavet - vincent.pica...@oslandia.com
www.oslandia.com - Engineering your GIS
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Using both and ST_Intersects in a query

2010-09-23 Thread Andrea Peri 2007




This would be true if ST_Intersects would'nt already include a bounding box
intersection step before trying the real intersection algorithm.
The magic is already in PostGIS :)


ok, I'm very glad to know this.

Now I need just another little step to complete the question:

The bounding-box intersection used in the ST_Intersects is used even 
when there isn't an index available on geometry field ?


Thx for clarification.

Andrea.


Il 23/09/2010 18:36, Vincent Picavet ha scritto:

Hi,


this mean that a query filter like this:

select ...
from
table1 as a,
table2 as b
where
(  (a.geom  b.geom)  (ST_Intersects(a.geom,b.geom)=true ) )

if faster than a query without the
like this:

select ...
from
table1 as a,
table2 as b
where
(  ST_Intersects(a.geom,b.geom)=true  )

This would be true if ST_Intersects would'nt already include a bounding box
intersection step before trying the real intersection algorithm.
The magic is already in PostGIS :)

But you can try the difference with _st_intersects, which only does the
geometric intersection without the bbox comparison first.

Vincent



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


[postgis-users] How remove a single part from a multipart geometry

2010-09-23 Thread Andrea Peri 2007

 Hi,

I need to remove a single part from a multipart geometry.

For example having a multipolygon with three part I need to remove one 
of these parts so the result is a multipolygon with two parts.


In postgis I find a function to extract a single part from a multipart ( 
ST_GeometryN ) but don't find nothing to remove one.


So the only method I know is re-create the geometry skipping the part 
unwanted, but I hope to find somethink more simple.


Thx,

Andrea.

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


Re: [postgis-users] How remove a single part from a multipart geometry

2010-09-23 Thread Mike Toews
There aren't any delete/remove/drop geometry functions, so you would
need dissect and re-create the geometry.

But, if you want to do this visually, this is easy. If you have a
recent version of QGIS, just start editing and use the Delete part
edit tool.

-Mike

On 23 September 2010 10:28, Andrea Peri 2007 aperi2...@gmail.com wrote:
  Hi,

 I need to remove a single part from a multipart geometry.

 For example having a multipolygon with three part I need to remove one of
 these parts so the result is a multipolygon with two parts.

 In postgis I find a function to extract a single part from a multipart (
 ST_GeometryN ) but don't find nothing to remove one.

 So the only method I know is re-create the geometry skipping the part
 unwanted, but I hope to find somethink more simple.

 Thx,

 Andrea.

 ___
 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