concept intersection in category postgis

This is an excerpt from Manning's book PostGIS in Action, Third Edition.
Figure 8.2. The polygon (private property) is overlaid with the linestring (planned road) at left. At right is the intersection of the two. The intersection results in a multilinestring.
![]()
Listing 8.1. Intersection of Polygon and LineString
SELECT ST_Intersects(g.geom1,g.geom2) As intersect, GeometryType(ST_Intersection(g.geom1,g.geom2)) As intersection FROM ( SELECT ST_GeomFromText(' POLYGON(( 2 4.5,3 2.6,3 1.8,2 0, -1.5 2.2,0.056 3.222, -1.5 4.2,2 6.5,2 4.5 ))' ) As geom1, ST_GeomFromText('LINESTRING(-0.62 5.84,-0.8 0.59)') As geom2 ) AS g;
The trickiest part of reverse geocoding is figuring out which side of the street your point is on, because TIGER streets only have centerlines. Without getting too much into topology, think of TIGER street centerlines as forming a network of connected nodes. In the parlance of topology, the centerlines would be called edges, and the nodes are the intersections of edges. With the U.S. completely partitioned into areas bounded on all sides with streets, a point must lie in one of the areas, or faces in topo-speak. If the point falls in the right face relative to the closest edge, it must be on the right side of the street. If the point is on the left face, then it’s on the left side. The reverse geocoder will be able to find a unique, closest interpolated numerical street number unless your point lacks sufficient significant digits and ends up on an intersection or is on a multilevel roadway. In cases where the reverse geocoder can’t pinpoint a single address, such as if it falls on the corner of two streets, it will return the set of all possible addresses. To help you pick from multiple possible addresses, the reverse geocoder also includes the coordinates of the addresses and the nearest cross-streets.