Re: [postgis-users] PostGIS Topology Pledge: completed !

2012-01-30 Thread Sandro Santilli
On Mon, Jan 30, 2012 at 10:55:41PM +, Martin Tomko wrote:
> Excellent work strk, thanks for this!
> Could you please provide some examples how this can be used in queries? Does 
> it speed up querying for neighbours etc.?

The focus insofar is about normalized storage. Speed you can squeeze out
but you're mostly on your own in this phase. If you understand the model
correctly you'll figure out how to build your queries in order to go faster,
and what you'd like to have in the core to speed it up further.

For nearest neighbours you'd use the same calls you would for simple
geometries but you'd be looking at edges rather than full polygons, thus
making a better use of the index.

> Also, does it support network topologies, something I could use with 
> pgrouting or so?

Nope, this is strictly planar topology.

--strk;

  ,--o-. 
  |   __/  |Thank you for PostGIS-2.0 Topology !
  |  / 2.0 |http://www.pledgebank.com/postgistopology
  `-o--'

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


[postgis-users] PostGIS Topology Pledge: completed !

2012-01-30 Thread Martin Tomko
Excellent work strk, thanks for this!
Could you please provide some examples how this can be used in queries? Does it 
speed up querying for neighbours etc.?
Also, does it support network topologies, something I could use with pgrouting 
or so?

Thanks,
Martin
--

Martin Tomko, PhD.
Senior Project Manager, Information Infrastructure Design, AURIN
Level 5, Architecture Building
University of Melbourne VIC 3010
AUSTRALIA

T:  +61 3 9035 3298
E:  tom...@unimelb.edu.au 
W: www.aurin.org.au 
W: http://martintomko.wordpress.com/

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


Re: [postgis-users] PostGIS Topology Pledge: completed !

2012-01-30 Thread Sandro Santilli
On Mon, Jan 30, 2012 at 04:34:44PM +0200, Sindile Bidla wrote:
> Thanks strk,
> 
> I was trying to use the topology functions.
> 
> UPDATE public.sa_provinces
>   SET topogeom = toTopoGeom(the_geom, 'sa_provinces_topo');
> 
> I get the following message:
> 
> ERROR:  function totopogeom(geometry, unknown) does not exist
> LINE 2:   SET topogeom = toTopoGeom(the_geom, 'sa_provinces_topo');

Oops, my fault, it lacks a layer_id, which is the one returned by
the previous call to AddTopoGeometryColumn, so assuming you followed
my steps (and thus created a single topology layer) it becomes:

 UPDATE public.states
   SET topogeom = toTopoGeom(geom, 'states_topo', 1);


Full session again:


 SELECT CreateTopology('states_topo');
 SELECT AddTopoGeometryColumn('states_topo',
  'public', 'states', 'topogeom',
  'POLYGON');
 UPDATE public.states
   SET topogeom = toTopoGeom(geom, 'states_topo', 1);


--strk;

  ,--o-. 
  |   __/  |Thank you for PostGIS-2.0 Topology !
  |  / 2.0 |http://www.pledgebank.com/postgistopology
  `-o--'

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


Re: [postgis-users] PostGIS Topology Pledge: completed !

2012-01-30 Thread Sindile Bidla
Thanks strk,

I was trying to use the topology functions.

UPDATE public.sa_provinces
  SET topogeom = toTopoGeom(the_geom, 'sa_provinces_topo');

I get the following message:

ERROR:  function totopogeom(geometry, unknown) does not exist
LINE 2:   SET topogeom = toTopoGeom(the_geom, 'sa_provinces_topo');
 ^
HINT:  No function matches the given name and argument types. You might
need to add explicit type casts.


Before running this function i used SET serch_path TO topology, public;

Any pointer what might i be doing wrong.


On 30 January 2012 14:47, Ben Madin  wrote:

> Thanks strk,
>
> this is great news - thank you for your efforts,
>
> cheers
>
> Ben
>
>
> On 30/01/2012, at 7:49 PM, Sandro Santilli wrote:
>
> > As of revision 8963 (included in upcoming 2.0.0alpha3 [1]), the function
> > to convert simple layers to topologically defined layers [2] is
> completed.
> >
> > [1] 2.0.0alpha3 http://www.postgis.org/download/
> > [2] toTopoGeom http://trac.osgeo.org/postgis/ticket/1017
> >
> > This means that building a persistent topology for your
> public.states.geom
> > layer would be as simple as this:
> >
> > SELECT CreateTopology('states_topo');
> > SELECT AddTopoGeometryColumn('states_topo',
> >  'public', 'states', 'topogeom',
> >  'POLYGON');
> > UPDATE public.states
> >   SET topogeom = toTopoGeom(geom, 'states_topo');
> >
> > You can then check correctness of the conversion:
> >
> > SELECT gid FROM public.states WHERE NOT ST_Equals(geom, topogeom);
> >
> > Look for area overlaps:
> >
> > SELECT r1.element_id FROM states_topo.relation r1, states_topo.relation
> r2
> > WHERE r1.topogeo_id != r2.topogeo_id AND r1.element_id = r2.element_id;
> >
> > Or underlaps:
> >
> > SELECT face_id FROM istat_topo.face WHERE face_id > 0
> > AND face_id NOT IN ( SELECT element_id FROM istat_topo.relation );
> >
> > Perform any editing required to clean things up [3], or to simplify the
> edges.
> > You can take a look at the primitives with QGIS db_manager plugin [4],
> or even
> > at the actual TopoGeometries with QGIS master [5] (although it will be
> slow in
> > selecting features within the viewport, see ticket #1290 [6]).
> >
> > [3]
> http://strk.keybit.net/blog/2011/11/21/topology-cleaning-with-postgis/
> > [4] qgis db_manager http://www.qgis.org/wiki/DB_Manager_plugin_GSoC_2011
> > [5] QuantumGIS http://www.qgis.org
> > [6] overlap TopoGeometry http://trac.osgeo.org/postgis/ticket/1290
> >
> > And of course you can convert TopoGeometries back to simple geometries
> when needed
> > for performance or compatibility reasons:
> >
> > ALTER TABLE public.states ADD newgeom geometry;
> > UPDATE public.states SET newgeom = topogeom::geometry;
> >
> > Happy edge walking!
> > http://strk.keybit.net/blog/2012/01/28/a-walk-on-the-wild-side/
> >
> > 
> >  C L O S I N GC R E D I T S
> > 
> >
> > I was able to dedicate my time to the implementation of the toTopoGeom
> > function thanks to the contribution of a disparate group of people and
> > companies putting a part of the money each to reach the bigger target:
> >
> >   Andrea PeriAnne Ghisla   R3 GIS
> >   Silvio Grosso  GFOSS (gfoss.it)  Cooperativa Alveo
> >   AusVet Ingvild Nystuen   Luca S. Percich
> >   Richard Greenwod   Andreas Neumann   Oslandia
> >
> > A special thank goes to Andrea Peri for his initial kick-starter
> contribution
> > which allowed me to set an affordable target for the pledge.
> >
> > Also thanks to the Geographical Free and Open Source Software association
> > (GFOSS) for the help with reducing paperwork involved in handling all the
> > contributions.
> >
> > --strk;
> >
> >  ,--o-.
> >  |   __/  |Thank you for PostGIS-2.0 Topology !
> >  |  / 2.0 |http://www.pledgebank.com/postgistopology
> >  `-o--'
> >
> > ___
> > postgis-users mailing list
> > postgis-users@postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
> --
>
> Ben Madin
>
> t : +61 8 6102 5535
> m : +61 448 887 220
> e : b...@ausvet.com.au
>
> AusVet Animal Health Services
> P.O. Box 5467
> Broome   WA   6725
> Australia
>
> AusVet's website:  http://www.ausvet.com.au/
>
> This transmission is for the intended addressee only and anyone else
> subscribed to this mailing list. Clearly then it is not confidential
> information. If you have received this transmission in error, sorry. The
> contents of this email are the opinion of the writer only and are not
> endorsed by AusVet Animal Health Services unless expressly stated
> otherwise. Although AusVet uses virus scanning software we do not accept
> liability for viruses or similar in any attachments. Congratulations on
> reading this boring and probably completely unnecessary bit - you may be
> the only person

Re: [postgis-users] PostGIS Topology Pledge: completed !

2012-01-30 Thread Ben Madin
Thanks strk,

this is great news - thank you for your efforts,

cheers

Ben


On 30/01/2012, at 7:49 PM, Sandro Santilli wrote:

> As of revision 8963 (included in upcoming 2.0.0alpha3 [1]), the function
> to convert simple layers to topologically defined layers [2] is completed.
> 
> [1] 2.0.0alpha3 http://www.postgis.org/download/
> [2] toTopoGeom http://trac.osgeo.org/postgis/ticket/1017
> 
> This means that building a persistent topology for your public.states.geom
> layer would be as simple as this:
> 
> SELECT CreateTopology('states_topo');
> SELECT AddTopoGeometryColumn('states_topo',
>  'public', 'states', 'topogeom',
>  'POLYGON');
> UPDATE public.states
>   SET topogeom = toTopoGeom(geom, 'states_topo');
> 
> You can then check correctness of the conversion:
> 
> SELECT gid FROM public.states WHERE NOT ST_Equals(geom, topogeom);
> 
> Look for area overlaps:
> 
> SELECT r1.element_id FROM states_topo.relation r1, states_topo.relation r2
> WHERE r1.topogeo_id != r2.topogeo_id AND r1.element_id = r2.element_id;
> 
> Or underlaps:
> 
> SELECT face_id FROM istat_topo.face WHERE face_id > 0
> AND face_id NOT IN ( SELECT element_id FROM istat_topo.relation );
> 
> Perform any editing required to clean things up [3], or to simplify the edges.
> You can take a look at the primitives with QGIS db_manager plugin [4], or even
> at the actual TopoGeometries with QGIS master [5] (although it will be slow in
> selecting features within the viewport, see ticket #1290 [6]).
> 
> [3] http://strk.keybit.net/blog/2011/11/21/topology-cleaning-with-postgis/
> [4] qgis db_manager http://www.qgis.org/wiki/DB_Manager_plugin_GSoC_2011
> [5] QuantumGIS http://www.qgis.org
> [6] overlap TopoGeometry http://trac.osgeo.org/postgis/ticket/1290
> 
> And of course you can convert TopoGeometries back to simple geometries when 
> needed
> for performance or compatibility reasons:
> 
> ALTER TABLE public.states ADD newgeom geometry;
> UPDATE public.states SET newgeom = topogeom::geometry;
> 
> Happy edge walking!
> http://strk.keybit.net/blog/2012/01/28/a-walk-on-the-wild-side/
> 
> 
>  C L O S I N GC R E D I T S
> 
> 
> I was able to dedicate my time to the implementation of the toTopoGeom
> function thanks to the contribution of a disparate group of people and
> companies putting a part of the money each to reach the bigger target:
> 
>   Andrea PeriAnne Ghisla   R3 GIS
>   Silvio Grosso  GFOSS (gfoss.it)  Cooperativa Alveo
>   AusVet Ingvild Nystuen   Luca S. Percich
>   Richard Greenwod   Andreas Neumann   Oslandia
> 
> A special thank goes to Andrea Peri for his initial kick-starter contribution
> which allowed me to set an affordable target for the pledge.
> 
> Also thanks to the Geographical Free and Open Source Software association
> (GFOSS) for the help with reducing paperwork involved in handling all the
> contributions.
> 
> --strk;
> 
>  ,--o-. 
>  |   __/  |Thank you for PostGIS-2.0 Topology !
>  |  / 2.0 |http://www.pledgebank.com/postgistopology
>  `-o--'
> 
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



-- 

Ben Madin

t : +61 8 6102 5535
m : +61 448 887 220
e : b...@ausvet.com.au

AusVet Animal Health Services
P.O. Box 5467
Broome   WA   6725
Australia

AusVet's website:  http://www.ausvet.com.au/

This transmission is for the intended addressee only and anyone else subscribed 
to this mailing list. Clearly then it is not confidential information. If you 
have received this transmission in error, sorry. The contents of this email are 
the opinion of the writer only and are not endorsed by AusVet Animal Health 
Services unless expressly stated otherwise. Although AusVet uses virus scanning 
software we do not accept liability for viruses or similar in any attachments. 
Congratulations on reading this boring and probably completely unnecessary bit 
- you may be the only person ever to do so!


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


Re: [postgis-users] PostGIS Topology Pledge: completed !

2012-01-30 Thread Sandro Santilli
On Mon, Jan 30, 2012 at 01:01:12PM +0100, Jose Carlos Martinez wrote:

> It would be really nice if some people from QGIS, gvSIG, uDIG, etc.
> start thinking about building a plugin for it.

We've discussed it some for QGIS in Zurich, mostly storming and comparing
GRASS and PostGIS topology to see if they could share some handling code.

I came back home with a few topologies drafted on tissue paper and some
notes about the required interface for a QGIS Provider. But didn't
organize that information yet.

A pre-Zurich attempt at organizing ideas about qgis-pgis topo editing
is here: https://github.com/strk/qgis_pgis_topoedit/wiki

At the moment it only contains a table of ISO/SQLMM editing functions 
and an indication of which datastores could be affected by each, but
will likely be the place in which I'll add outcomes of the Zurich meeting.

--strk; 

  ,--o-. 
  |   __/  |Thank you for PostGIS-2.0 Topology !
  |  / 2.0 |http://www.pledgebank.com/postgistopology
  `-o--'

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


Re: [postgis-users] PostGIS Topology Pledge: completed !

2012-01-30 Thread Jose Carlos Martinez

Great news,
Congratulations! Lets try it!!
It would be really nice if some people from QGIS, gvSIG, uDIG, etc.  
start thinking about building a plugin for it.

Regards,
Jose

On 30/01/2012 12:49, Sandro Santilli wrote:

As of revision 8963 (included in upcoming 2.0.0alpha3 [1]), the function
to convert simple layers to topologically defined layers [2] is completed.

  [1] 2.0.0alpha3 http://www.postgis.org/download/
  [2] toTopoGeom http://trac.osgeo.org/postgis/ticket/1017

This means that building a persistent topology for your public.states.geom
layer would be as simple as this:

  SELECT CreateTopology('states_topo');
  SELECT AddTopoGeometryColumn('states_topo',
   'public', 'states', 'topogeom',
   'POLYGON');
  UPDATE public.states
SET topogeom = toTopoGeom(geom, 'states_topo');

You can then check correctness of the conversion:

  SELECT gid FROM public.states WHERE NOT ST_Equals(geom, topogeom);

Look for area overlaps:

  SELECT r1.element_id FROM states_topo.relation r1, states_topo.relation r2
  WHERE r1.topogeo_id != r2.topogeo_id AND r1.element_id = r2.element_id;

Or underlaps:

  SELECT face_id FROM istat_topo.face WHERE face_id>  0
  AND face_id NOT IN ( SELECT element_id FROM istat_topo.relation );

Perform any editing required to clean things up [3], or to simplify the edges.
You can take a look at the primitives with QGIS db_manager plugin [4], or even
at the actual TopoGeometries with QGIS master [5] (although it will be slow in
selecting features within the viewport, see ticket #1290 [6]).

  [3] http://strk.keybit.net/blog/2011/11/21/topology-cleaning-with-postgis/
  [4] qgis db_manager http://www.qgis.org/wiki/DB_Manager_plugin_GSoC_2011
  [5] QuantumGIS http://www.qgis.org
  [6] overlap TopoGeometry http://trac.osgeo.org/postgis/ticket/1290

And of course you can convert TopoGeometries back to simple geometries when 
needed
for performance or compatibility reasons:

  ALTER TABLE public.states ADD newgeom geometry;
  UPDATE public.states SET newgeom = topogeom::geometry;

Happy edge walking!
http://strk.keybit.net/blog/2012/01/28/a-walk-on-the-wild-side/

  
   C L O S I N GC R E D I T S
  

I was able to dedicate my time to the implementation of the toTopoGeom
function thanks to the contribution of a disparate group of people and
companies putting a part of the money each to reach the bigger target:

Andrea PeriAnne Ghisla   R3 GIS
Silvio Grosso  GFOSS (gfoss.it)  Cooperativa Alveo
AusVet Ingvild Nystuen   Luca S. Percich
Richard Greenwod   Andreas Neumann   Oslandia

A special thank goes to Andrea Peri for his initial kick-starter contribution
which allowed me to set an affordable target for the pledge.

Also thanks to the Geographical Free and Open Source Software association
(GFOSS) for the help with reducing paperwork involved in handling all the
contributions.

--strk;

   ,--o-.
   |   __/  |Thank you for PostGIS-2.0 Topology !
   |  / 2.0 |http://www.pledgebank.com/postgistopology
   `-o--'

___
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] PostGIS Topology Pledge: completed !

2012-01-30 Thread Sandro Santilli
As of revision 8963 (included in upcoming 2.0.0alpha3 [1]), the function
to convert simple layers to topologically defined layers [2] is completed.

 [1] 2.0.0alpha3 http://www.postgis.org/download/
 [2] toTopoGeom http://trac.osgeo.org/postgis/ticket/1017

This means that building a persistent topology for your public.states.geom
layer would be as simple as this:

 SELECT CreateTopology('states_topo');
 SELECT AddTopoGeometryColumn('states_topo',
  'public', 'states', 'topogeom',
  'POLYGON');
 UPDATE public.states
   SET topogeom = toTopoGeom(geom, 'states_topo');

You can then check correctness of the conversion:

 SELECT gid FROM public.states WHERE NOT ST_Equals(geom, topogeom);

Look for area overlaps:

 SELECT r1.element_id FROM states_topo.relation r1, states_topo.relation r2
 WHERE r1.topogeo_id != r2.topogeo_id AND r1.element_id = r2.element_id;

Or underlaps:

 SELECT face_id FROM istat_topo.face WHERE face_id > 0
 AND face_id NOT IN ( SELECT element_id FROM istat_topo.relation );

Perform any editing required to clean things up [3], or to simplify the edges.
You can take a look at the primitives with QGIS db_manager plugin [4], or even
at the actual TopoGeometries with QGIS master [5] (although it will be slow in
selecting features within the viewport, see ticket #1290 [6]).

 [3] http://strk.keybit.net/blog/2011/11/21/topology-cleaning-with-postgis/
 [4] qgis db_manager http://www.qgis.org/wiki/DB_Manager_plugin_GSoC_2011
 [5] QuantumGIS http://www.qgis.org
 [6] overlap TopoGeometry http://trac.osgeo.org/postgis/ticket/1290

And of course you can convert TopoGeometries back to simple geometries when 
needed
for performance or compatibility reasons:

 ALTER TABLE public.states ADD newgeom geometry;
 UPDATE public.states SET newgeom = topogeom::geometry;

Happy edge walking!
http://strk.keybit.net/blog/2012/01/28/a-walk-on-the-wild-side/

 
  C L O S I N GC R E D I T S
 

I was able to dedicate my time to the implementation of the toTopoGeom
function thanks to the contribution of a disparate group of people and
companies putting a part of the money each to reach the bigger target:

   Andrea PeriAnne Ghisla   R3 GIS
   Silvio Grosso  GFOSS (gfoss.it)  Cooperativa Alveo
   AusVet Ingvild Nystuen   Luca S. Percich
   Richard Greenwod   Andreas Neumann   Oslandia

A special thank goes to Andrea Peri for his initial kick-starter contribution
which allowed me to set an affordable target for the pledge.

Also thanks to the Geographical Free and Open Source Software association
(GFOSS) for the help with reducing paperwork involved in handling all the
contributions.

--strk;

  ,--o-. 
  |   __/  |Thank you for PostGIS-2.0 Topology !
  |  / 2.0 |http://www.pledgebank.com/postgistopology
  `-o--'

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