ThinkGeo.com    |     Documentation    |     Premium Support

List of intersecting streets

Hello

We used the code to find two intersecting streets, but now i have a question whether we can modify the code or have a simpler way to get a list of all streets which intersect with a particular street. If you can help us that would be great.

Thanks

Hi Saddam, 
  
 I think this API should be helpful. 
  
 inMemoryFeatureLayer.QueryTools.GetFeaturesIntersecting(targetShape, ReturningColumnsType.AllColumns); 
  
 What you want to do is put your list of streets into the InMemoryFeatureLayer. 
  
 Regards, 
  
 Don

Hi Don 
  
 Could you please provide me with a sample code for it i would really appreciate it. 
  
 Thanks

Hi Saddam, 
  
 I wish the code is helpful. 
  
  

 ShapeFileFeatureLayer layer = new ShapeFileFeatureLayer(“Your Data Path”);

            layer.Open();
            Collection<Feature> features = layer.FeatureSource.GetAllFeatures(ReturningColumnsType.NoColumns);


            Collection<Feature> resultFeatures;// Write code to get your list of streets from all features.
            Feature line;//It’s your particular street

            InMemoryFeatureLayer imFeatureLayer = new InMemoryFeatureLayer();

            foreach (Feature feature in resultFeatures)
            {
                imFeatureLayer.InternalFeatures.Add(feature);
            }

            imFeatureLayer.BuildIndex();
            imFeatureLayer.Open();

            Collection<Feature> intersectingFeature = imFeatureLayer.QueryTools.GetFeaturesIntersecting(line, ReturningColumnsType.NoColumns);


Hi Saddam, 
  
 I wish the code is helpful. 
  
  

 ShapeFileFeatureLayer layer = new ShapeFileFeatureLayer(“Your Data Path”);

            layer.Open();
            Collection<Feature> features = layer.FeatureSource.GetAllFeatures(ReturningColumnsType.NoColumns);


            Collection<Feature> resultFeatures;// Write code to get your list of streets from all features.
            Feature line;//It’s your particular street

            InMemoryFeatureLayer imFeatureLayer = new InMemoryFeatureLayer();

            foreach (Feature feature in resultFeatures)
            {
                imFeatureLayer.InternalFeatures.Add(feature);
            }

            imFeatureLayer.BuildIndex();
            imFeatureLayer.Open();

            Collection<Feature> intersectingFeature = imFeatureLayer.QueryTools.GetFeaturesIntersecting(line, ReturningColumnsType.NoColumns);
 
  
 Regards, 
  
 Don