ThinkGeo.com    |     Documentation    |     Premium Support

Find intersection with Feature layer and memory layer

Hello,


I am adding county data as a ShapeFileFeatureLayer.  Then I am adding InMemoryFeatureLayer of ski resorts.  To find the intersection, I am assuming that I would have to loop through the county layer and within that loop, loop through the InMemoryFeatureLayer layer.


My question is:

1. How do you loop through the ShapeFileFeatureLayer layer?

2. How do you loop through the InMemoryFeatureLayer layer?

3. How do you determine if they intersect?

4. How do you get the feature information of the two that intersected?  For example (County A, Park City)


Thanks, Steven




  protected void Page_Load(object sender, EventArgs e)

  {

    if(!Page.IsPostBack)

    {

      ShapeFileFeatureLayer usaCountyILPyLayer = new ShapeFileFeatureLayer(@"\County.shp");

      usaCountyILPyLayer.ZoomLevelSet.ZoomLevel07.DefaultAreaStyle = AreaStyles.County2;

      usaCountyILPyLayer.ZoomLevelSet.ZoomLevel07.DefaultTextStyle = TextStyles.Capital3("COUNTY_NAM");

      usaCountyILPyLayer.ZoomLevelSet.ZoomLevel07.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("COUNTY_NAM", "Arial", 8, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 3, 3);

      usaCountyILPyLayer.ZoomLevelSet.ZoomLevel07.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

      Map1.StaticOverlay.Layers.Add("usacityLayer", usacityLayer);

 }


  public void CreateShapeLayersLocalData()

  {

    CreateShapLayer("ShapeLayerAspen", "38.929237", "-119.984347", 10, PointSymbolType.Circle, GeoColor.StandardColors.Blue);

    CreateShapLayer("ShapeLayerWilmotMtn", "42.512778", "-88.181944", 10, PointSymbolType.Circle, GeoColor.StandardColors.Blue);

    CreateShapLayer("ShapeLayerVail", "39.635757", "-106.362984", 10, PointSymbolType.Circle, GeoColor.StandardColors.Blue);

    CreateShapLayer("ShapeLayerBreckenridge", "39.486445", "-106.043516", 10, PointSymbolType.Circle, GeoColor.StandardColors.Blue);

    CreateShapLayer("ShapeLayerLakeTahoe", "38.929237", "-119.984347", 10, PointSymbolType.Circle, GeoColor.StandardColors.Blue);

    CreateShapLayer("ShapeLayerParkCity", "40.659306", "-111.499828", 10, PointSymbolType.Circle, GeoColor.StandardColors.Blue);

    CreateShapLayer("ShapeLayerSnowBird", "40.617147", "-111.820361", 10, PointSymbolType.Circle, GeoColor.StandardColors.Blue);

    CreateShapLayer("ShapeLayerSolitude", "38.373038", "-110.714039", 10, PointSymbolType.Circle, GeoColor.StandardColors.Blue);


    LoopThroughShapes();

   }


  protected void CreateShapLayer(string cellName, string cellLat, string cellLong, float cellSize, PointSymbolType symbolType, GeoColor symbolColor)

  {

    InMemoryFeatureLayer addShapeLayer = new InMemoryFeatureLayer();

    addShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(symbolType, symbolColor, cellSize);

    addShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

    Map1.DynamicOverlay.Layers.Add(cellName, addShapeLayer);


    Feature pointFeature = new Feature

     (new PointShape(

      double.Parse(cellLong, CultureInfo.InvariantCulture),

      double.Parse(cellLat, CultureInfo.InvariantCulture)));


    addShapeLayer.InternalFeatures.Add(pointFeature.Id, pointFeature);

    Map1.DynamicOverlay.Redraw();

   }



Steven, 
  
 We need more time on this, we will let you know when find out. 
  
 Thanks, 
  
 Ben