Intersection on topo

17 views
Skip to first unread message

Artur Krawczyk

unread,
Jul 5, 2022, 5:54:37 PMJul 5
to spatiali...@googlegroups.com
I would like to know if in spatialite you can overlap topologies? 

select CreateTopology('oneT',2180,0,0)

Using the commands: ST_AddIsoNode ST_AddIsoEdge ST_AddEdgeNewFaces 
I created a geometry that is topologically correct inside oneT topology 

select CreateTopology('secondT',2180,0,0)
  Using the commands: ST_AddIsoNode ST_AddIsoEdge ST_AddEdgeNewFaces 
I created a geometry that is topologically correct inside secondT topology 

Is there a command that intersects these two geometries (two topologies) oneT  with secondT topology? 

Regards,
Artur K, 

a.fu...@lqt.it

unread,
Jul 6, 2022, 2:31:32 AMJul 6
to spatiali...@googlegroups.com
Hi Artur,

I'm not really sure to understand your question.

You apparently seem to assume that a "topology" is the
equivalent of a "geometry", but this is conceptually wrong.

a "topology" is a complex set of many Node, Edge and Face
primitives ... may well be millions and millions of them.

determining the intesections between two different Topologies
is consequently a nonsense.

what you probably mean is to get a topological set of
many different individual "geometries" wich could may
be have reciprocal intersections between them.

in this case you simply have to create just a single
Topology then inserting all your "geometries" into it.

you can use SQL functions such as TopoGeo_AddPoint()
[for POINT geometries] and/or TopoGeo_AddLineString()
[for LINESTRING or POLYGON-RING geometries]; both
functions accept a single geometry at each time.

even better, you can directly call TopoGeo_FromGeoTable()
[note that there are several flavours of it] in order
to directly transform a full layer of "geometries"
into a corresponding Topology.

in any case the dirty work of identifying all intersections
and overlaps transforming all them in a Topological coherent
set of Nodes, Edges and Faces will be silently performed as
required in the most painless way.

bye Sandro

Artur Krawczyk

unread,
Jul 6, 2022, 3:41:15 AMJul 6
to spatiali...@googlegroups.com
Hi Sandro, 
Thank you very much for your reply. Unfortunately, I didn't fully understand it - and I learned about new things that I can't understand. 
Therefore, let me divide the question into two parts.
1) First - Two topologies 
image.png
tplot - A large number of plots (or parcels) in some county, dozens or even hundreds of plots - a lot of nodes, borders and faces  (existing objects)
troad - the geometry of the road being designed (this is just a plan - but there is a precision geometry specified for this project for this county) 
I do not want to mix the geometry of the plots with the geometry of the designed road. 
I would like to use the function to intersect these two topologies between themselves.. Is it possible to perform such operations on these topologies?

2) Second  "TopoGeo_FromGeoTable()" 
Sorry but only yesterday I read something about the "TopoGeo_FromGeoTable()" function and I do not fully understand the concept of how this function works. 
Using this function "TopoGeo_FromGeoTable()" can I turn geometry from "tplot" (node-border) into geometry - polygon (WKB)?
If so, further analysis I can use ST_Intersection function. 

Artur K, 
 

a.fu...@lqt.it

unread,
Jul 6, 2022, 4:40:54 AMJul 6
to spatiali...@googlegroups.com
On Wed, 6 Jul 2022 09:41:00 +0200, Artur Krawczyk wrote:
> Therefore, let me divide the question into two parts.
> 1) First - Two topologies 
>
> tplot - A large number of plots (or parcels) in some county, dozens
> or even hundreds of plots - a lot of nodes, borders and faces 
> (existing objects)
> troad - the geometry of the road being designed (this is just a plan
> - but there is a precision geometry specified for this project for
> this county) 
> I do not want to mix the geometry of the plots with the geometry of
> the designed road. 
>
> I would like to use the function to intersect these two topologies
> between themselves.. Is it possible to perform such operations on
> these topologies?
>

absolutely NO. full stop.

a Topology is a self constrained Universe; comparing it in
any way with another different Topology has no sense at all.

"intersection" requires Geometries and not Topologies.

What you can do is:
1) transform both topologies into ordinary Geometry-based
tables (e.g. by calling TopoGeo_ToGeoTable)

2) then calling ST_Intersects() for indentifying all possible
intersection between the two "geom-tables" deriving from
the previous step.


> 2) Second  "TopoGeo_FromGeoTable()" 
>
> Sorry but only yesterday I read something about the
> "TopoGeo_FromGeoTable()" function and I do not fully understand the
> concept of how this function works. 
>
> Using this function "TopoGeo_FromGeoTable()" can I turn geometry from
> "tplot" (node-border) into geometry - polygon (WKB)?
>

pay close attention, because you make some confusion between WKB
and native binaries geometries of SpatiaLite, that are a different
thing.

TopoGeo_FromGeoTable() works exactly in the opposti way;
it transforms a whole Geometry-Table into a corresponding
Topology.

For transforming a Topology into a corresponding Geometry-Table
you should call instead TopoGeo_ToGeoTable().


> If so, further analysis I can use ST_Intersection function. 
>

certainly yes: ST_Intersection() and ST_Intersects() are
the only two SQL functions intended for identifying any
possible intesection between geometries.
but they only accept Geometries and not Topologies.

said in different words:
a) a first conceptual model is the one based on OGC
Geometries (Points, Linestrings, Polygons etc)

b) a second conceptual model is the one based on ISO
Topologies, that implies a completely different
approach.

you can never mix the one with the other because they
are mutually not compatible.

what you can do is to transform Geometries into
Topologies or Topologies into Geometries, in such
a way as to correctly compare apples with apples
and oranges with oranges.

by Sandro



Artur Krawczyk

unread,
Jul 6, 2022, 6:21:45 AMJul 6
to spatiali...@googlegroups.com
> Therefore, let me divide the question into two parts.
> 1) First - Two topologies 
>
> tplot - A large number of plots (or parcels) in some county, dozens
> or even hundreds of plots - a lot of nodes, borders and faces 
> (existing objects)
> troad - the geometry of the road being designed (this is just a plan
> - but there is a precision geometry specified for this project for
> this county) 
> I do not want to mix the geometry of the plots with the geometry of
> the designed road. 
>
> I would like to use the function to intersect these two topologies
> between themselves.. Is it possible to perform such operations on
> these topologies?
>

absolutely NO. full stop.

a Topology is a self constrained Universe; comparing it in
any way with another different Topology has no sense at all.

"intersection" requires Geometries and not Topologies.

What you can do is:
1) transform both topologies into ordinary Geometry-based
    tables (e.g. by calling TopoGeo_ToGeoTable)

2) then calling ST_Intersects() for indentifying all possible
    intersection between the two "geom-tables" deriving from
    the previous step.



Thank you Sandro for such an extensive explanation now I understand why this transition between TopoGeo_ToGeoTable and back TopoGeo_FromGeoTable()

More or less job will be like this: 
tplot topology table -> TopoGeo_ToGeoTable -> tplotGT (Geotable)
troad topology table -> TopoGeo_ToGeoTable -> troadGT (Geotable)

CREATE  TABLE pintGT .......... ST_Intersection  ( tplotGT,troadGT ) 
tinter a topology from  -  TopoGeo_FromGeoTable(pintGT)
tinter - topology table as a result of intersection ;-)  


Best Regards,
Artur K, 
Reply all
Reply to author
Forward
0 new messages