Zoom To Multiple Polyline.

3829
9
Jump to solution
02-13-2014 01:13 PM
SaurabhDasgupta
New Contributor II
Hi

I am developing a silverlight application to zoom to the polyline feature layer of ArcGIS Dynamic Service layer. I have been successful in doing so for the layers but for one of the layers it has got mulitiple polylines where it just zooms to the part of the feature and not of the whole feature. I am generating a list of feature in a list box as provided in the screen shot but as I said its generating multiple features which I dont want. I just want it as one feature in the list and as well as zoomed to the whole feature and not showing it to the part of the feature. Code is attached as well.

Any help will be appreciated.

Thanks,
Saurabh.
0 Kudos
1 Solution

Accepted Solutions
AhmedEl-Sisi
Occasional Contributor III
Thanks a lot for the code. I actually able to run the code and this is populating the values correctly to my combo box. But however on selection of any particular value the feature list turns out to be empty. Attaching the screen shot for that. Not sure why.

Any thoughts...

~Saurabh.


It seems that query task doesn't return results.

You should implement your zoom in Combobox Selection CHanged event.

 
 private void QueryComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)         {           GroupedFeatures features = e.AddedItems[0] as GroupedFeatures;                   if (features != null)             {                 ESRI.ArcGIS.Client.Geometry.Envelope selectedFeatureExtent = gf.GetFeaturesExtent();                 MyMap.ZoomTo(selectedFeatureExtent);             }         } 

View solution in original post

0 Kudos
9 Replies
by Anonymous User
Not applicable
Original User: e_saurabh

Any suggestions on this yet??
0 Kudos
MichaelVolz
Esteemed Contributor
Is this a multi-part polyline in the source data?  If not, I would suggest pre-processing the data to create multi-part polylines which you could do with a python script on say a weekly basis or whatever interval the data gets updated at.
0 Kudos
by Anonymous User
Not applicable
Original User: e_saurabh

Is this a multi-part polyline in the source data?  If not, I would suggest pre-processing the data to create multi-part polylines which you could do with a python script on say a weekly basis or whatever interval the data gets updated at.


Yes the source data is the multi-part polyline data. And I need to do this in Silverlight code to zoom to the total portion of the Polyline B. The data arrangement looks like this:

Polyline Data -1
Name - Polyline A 
Object ID - 1


Polyline Data -2  
                                      
Object ID - 1
Name - Polyline B
               
Object ID - 2
Name - Polyline B

Object ID - 3
Name - Polyline B

Regards,
Saurabh.
0 Kudos
SaurabhDasgupta
New Contributor II
Any updates....

~Saurabh.
0 Kudos
by Anonymous User
Not applicable
Original User: selcuktinaz

If you have a method like so;

            ZoomToGraphic(GraphicCollection col);

will  your problem be solved? If so i have a solution
0 Kudos
AhmedEl-Sisi
Occasional Contributor III
you can group features by attribute (polyline name) and add name in combobox with Its related features.
I have modified your sample code as attached.
0 Kudos
by Anonymous User
Not applicable
Original User: e_saurabh

you can group features by attribute (polyline name) and add name in combobox with Its related features.
I have modified your sample code as attached.


Thanks a lot for the code. I actually able to run the code and this is populating the values correctly to my combo box. But however on selection of any particular value the feature list turns out to be empty. Attaching the screen shot for that. Not sure why.

Any thoughts...

~Saurabh.
0 Kudos
AhmedEl-Sisi
Occasional Contributor III
Thanks a lot for the code. I actually able to run the code and this is populating the values correctly to my combo box. But however on selection of any particular value the feature list turns out to be empty. Attaching the screen shot for that. Not sure why.

Any thoughts...

~Saurabh.


It seems that query task doesn't return results.

You should implement your zoom in Combobox Selection CHanged event.

 
 private void QueryComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)         {           GroupedFeatures features = e.AddedItems[0] as GroupedFeatures;                   if (features != null)             {                 ESRI.ArcGIS.Client.Geometry.Envelope selectedFeatureExtent = gf.GetFeaturesExtent();                 MyMap.ZoomTo(selectedFeatureExtent);             }         } 
0 Kudos
by Anonymous User
Not applicable
Original User: e_saurabh

Awesome!!! that resolves my problem. But however with the ArcGIS Online USA States map on the background, this zooms to different location. But I guess thats coz these 2 map services having different spatial reference. I will try that later. But as of now my map zooms to total asset with the group features....

Thanks  Ahmed...

~Saurabh.
0 Kudos