Get Neighbor Links

Land Desktop Map 3D Samples

 
Get Neighbor Links
 
 
 

This method takes a point argument and returns an array of links. A link has three components: the start point of an MgLineString object, the end point of an MgLineString object, and an identifier value. It does the following:

  1. Uses the point argument and a delta value to create an MgCoordinateCollection object containing the coordinates of a linear ring around the point.
  2. Uses an MgGeometryFactory object and the MgCoordinateCollection object to create an MgPolygon object.
  3. Uses the geometry property name, the MgPolygon object, the EnvelopeIntersects operator, and an MgFeatureQueryOptions object to set a spatial filter.
  4. Uses an MgFeatureService object, the MgFeatureQueryOptions object, and the “Roads” MgResourceIdentifier object to select features that satisfy the spatial filter.
    NoteThat is, uses the given point and delta to construct a polygon, which defines a buffer around the point. It then selects features from the file whose geometry properties have envelopes which intersect with the polygon. An envelope is a rectangular bounding box, which completely encloses the feature geometry. Depending on the shape of the geometry, the envelope may contain points that lies outside the boundary of the geometry.
  5. For each selected feature do the following:
    • Get the feature properties as an MgPropertyCollection object. This is described in topic ReadFeature.
    • Get the identify property from the MgPropertyCollection object.
    • Get the geometry property from the MgPropertyCollection object.
    • Use an MgAgfReaderWriter object to create an MgGeometry object from the geometry property.
    • Determines that the MgGeometry object is null and loops to process the next feature
    • Determines that the MgGeometry object is not null. Assumes that the MgGeometry object is an MgLineString object and creates a Link object using the start and end points of the MgLineString object and value contained in the identity property.
    • Adds the Link object to an array.
  6. Returns the array.

The graphic shows the two LineStrings returned by this method given a point whose coordinates are (1899984, 457829). This point is that selected by the user when prompted for the start point in the course of running the NetworkTrace command.The callouts show the start and end points of LineString features from the perspective of the feature source.

The LineString feature, which is not connected to the start point selected by the user, is selected because its envelope intersects the start point.

The graphic shows the three LineStrings returned by this method given the point whose coordinates are (1902739, 458271). This point is that selected by the user when prompted for the end point in the course of running the NetworkTrace command.The callouts show the start and end points of LineString features from the perspective of the feature source. The NetworkTrace end point is a start point for two of the LineStrings and an end point for the third.