# modeling of spatial objects

I have a line and polygon in this image.

If i find the intersection of line exterior and polygon boundry, what will be the graphical representation of both objects intersection..

its my concept..

-
how can we find intersection of line exterior to polygon boundry? – tina Dec 15 '10 at 1:57
Sorry I am not quite understanding the question. Are you asking something like who would the results be visualised? or How would the mathematical Calculation be done to identify the intersection? Or How would you organise the records to identify inside or outside? Please clarify for me so I can help. CDB – CDBrown Dec 15 '10 at 3:36
well i want to know graphical representation and how can we find the intersection of line interior to Area exterior... – tina Dec 15 '10 at 8:50
can you please chat with me on msn or yahoo or any other messanger.. – tina Dec 15 '10 at 8:51
Well CDBrown is right, your question is VERY badly formulated, it's not clear what you're after and your comment has not shed very much light into that. Do you want to help with the algorithm to find this kind of intersection? Do you want to perform the calculation in an existing software environment? Does it have anything to do with the title (spatial modeling)? – Petr Krebs Dec 15 '10 at 9:54

If the line just crosses the border of the polygon as in your image the intersection of the boundary of the polygon and the exterior of the line will be the boundary of the polygon. But because of the intersections the boundary will go from LINESTRING to MULTILINESTRING and be interrupted by the intersections at least according to PostGIS (GEOS->JTS).

This is because
1) the exterior of the line is everything except the interior and the boundary of the line
2) The line has zero width so the interior part crossing the boundary will make no difference.

The intersection between the exterior of the line and the boundary of the polygon is the same as the difference between the line and the boundary of the polygon.

You can try it by running the queries below on http://postgisonline.org/map.php:

first: to see the geometries run:

``````SELECT 'LINESTRING(0 5, 10 6, 12 3, 20 3)'::geometry as the_geom
union all
SELECT ST_Boundary('POLYGON((15 4, 19 3, 21 6, 24 2, 18 0, 14 1, 15 4))'::geometry) as the_geom;
``````

by copying it into the terminal in the link and press "map1"

Then, since it is not possible to make a geometry of the exterior we use the difference between the boundary of the polygon and the line instead:

``````SELECT ST_Difference(a, b) as the_geom  FROM
(SELECT ST_Boundary('POLYGON((15 4, 19 3, 21 6, 24 2, 18 0, 14 1, 15 4))'::geometry) as a,
'LINESTRING(0 5, 10 6, 12 3, 20 3)'::geometry as b) t
``````

If you run this as "map2" instead of "map1" you will get the difference on top of the previous ran query.

To see the resulting coordinates and how they have been divided in three parts of the MULTILINESTRING, try:

``````SELECT ST_Astext(ST_Difference(a, b))  FROM
(SELECT ST_Boundary('POLYGON((15 4, 19 3, 21 6, 24 2, 18 0, 14 1, 15 4))'::geometry) as a,
'LINESTRING(0 5, 10 6, 12 3, 20 3)'::geometry as b) t
``````

Is this what you were thinking about?

Regards Nicklas

-

what will be the graphical representation of both objects intersection..