Click or drag to resize

PolygonIntersects Method (LatLon)

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Determines whether the Polygon intersects, contains, or touches a line.

Namespace:  Telogis.GeoBase.Geometry
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public bool Intersects(
	LatLon[] line
)

Parameters

line
Type: Telogis.GeoBaseLatLon
The line to test against.

Return Value

Type: Boolean
True if the Polygon intersects, contains, or touches the given line.
Examples
C#
// Create a four sided polygon in Los Angeles, Ca.
Telogis.GeoBase.Geometry.Polygon myPolygon = new Telogis.GeoBase.Geometry.Polygon(
    new Telogis.GeoBase.Geometry.LineString[] {
        new Telogis.GeoBase.Geometry.LineString(
        new LatLon(33.694165,-117.956236),
        new LatLon(33.697935,-117.842219),
        new LatLon(33.616715,-117.834638),
        new LatLon(33.625434,-117.937813),
        new LatLon(33.694165,-117.956236))
    }
);
// Create a Line that crosses over the polygon
Telogis.GeoBase.Geometry.LineString newLine = new Telogis.GeoBase.Geometry.LineString(
    new Telogis.GeoBase.LatLon[] {
            new Telogis.GeoBase.LatLon(33.671409,-117.969853),
            new Telogis.GeoBase.LatLon(33.585837,-117.781247)}
);
// Use the Intersects method to test whether the polygon contains, intersects or touches the line
Console.WriteLine("Do the polygon and line intersect? {0}", myPolygon.Intersects(newLine.Points));
// 'Do the polygon and line intersect? True'
See Also