|
POST
|
Map has a Cursor property, FeatureLayer has MouseEnter, MouseLeave events.
... View more
06-04-2012
07:06 AM
|
0
|
0
|
678
|
|
POST
|
Many thanks Joe for the tips, code and advice. I really appreciate it. I thought by picking a "project" I would grasp the concepts quicker but this is proving elusive with silverlight for me. Any way will keep at it. Just so we are on the same page, and for the benefits of other who may or may not be in the same predicament as me this is what I am looking to do 1. User enters a URL to a Map service, (see link above) - Currently this sample works for Tiled services - Looking to eventually extend this so service type doesn't matter. 2. With no map displayed on the map canvas yet, the sub-layers, if any, would be listed - in a folder or tree fashion. 3. User selects a sub-layer, and can at this point add it to or display it on the map canvas. And at this point it can be added to the legend control. A few things that impact what it seems like you want to do. Only Services can be added to a Map, the closest you could come to what you propose would be to add the service and have only the selected sublayer visible. Only ArcGISDynamicMapServiceLayer object can have visibility of sub layers changed. Tiled services can be added as ArcGISDynamicMapServiceLayer, but the performance benefits of tiled service would be lost. That only makes sense if you think about it, at the most basic level a Tiled service is a set of pre-created images served up when requested, so they cannot be changed. You can build the tree as you want but it is a bit convoluted in how it is done. A map service contains a LayerInfo collection which includes info about all the layers in the map that the service is created from (the object naming is terrible, imo). The LayerInfo object has a collection of SublayerIds. You have to go through and figure what is a sublayer of what The attached does pretty much what it seems you want as far as building the tree, there is too much there to try and just put code snippets. The TocViewModel contains code that builds a MapServiceLayer objects collection, Each MapServiceLayer represents a service and the layers/sublayers are then in its ObservableCollection<MapGroup>. I broke it out into two object type a MapGroup an MapServiceLayer, a MapServiceLayer is a MapGroup but defines the actual service. A MapGroup has its own MapGroup collection which has 0 or more elements. This works on the layers in an existing map but the principle would be the same. I bound the ObservableCollection<MapServiceLayer> to a treeview using HierarchicalDataTemplate like in my earlier post. Hope that helps -Joe
... View more
06-04-2012
01:50 AM
|
0
|
0
|
1131
|
|
POST
|
MyMap.ZoomToResolution(MyMap.Resolution / MyMap.ZoomFactor, mapPoint);
... View more
06-03-2012
10:25 AM
|
0
|
0
|
553
|
|
POST
|
Many thanks for the reply Joe. However I'm still lost. How is this implemented? When a users enters a URL how would and it's initialized and added to the map in the code behind, how is this then passed to the various elements in the XAML? Really struglling with getting the concept of linking elements from the C# code behind and the XAML elements. Any further help would be very much appreciated. I think you could really just do what you want using the Legend control in the toolkit just like in the sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#LegendWithTemplates. The legend is bound to the Map so anytime a layer is added or removed from the Map the legend will reflect those changes. As far as actually adding the layer itself you just create a Layer object and add to the Layers collections so in the code behind
string url = theUserUrl;
ArcGISDynamicMapServiceLayer layer = new ArcGISDynamicMapServiceLayer {Url = the UserUrl }; // this might be ArcGISTiledMapServiceLayer depending on the service type
MyMap.Layers.Add(layer);
<esri:Legend Map="{Binding ElementName=MyMap}"
That part of the xaml is what binds the Map to the Legend, so any changes to the Layers collection will be reflected in the Legend. Just be sure that in setting up the Legend control you do not give anything for LayerIDs property like they do in the sample. Setting LayerIDs causes some odd behavior (in my opinion) and when you add the new Layer it won't show up if this is set. It takes a bit for it to finally click, but data binding really is one of the key concepts to being successful with Silverlight, so it is worth spending some time to really understand how it works Hope that helps -Joe
... View more
06-03-2012
10:17 AM
|
0
|
0
|
1131
|
|
POST
|
So went back to this to see if I could track down the problem. Set up everything the same as it had been, and it is working update fine Graphics are loaded. I looked back in subversion and I swear it is the same code that was failing. I am going to blame it on solar flares or something of that nature. All I know is it is working so I will just be happy about that and move forward. Thanks -Joe
... View more
06-02-2012
09:10 PM
|
0
|
0
|
731
|
|
POST
|
I think you want to look at HierachicalDataTemplate. Here is an example I used for a similar type of purpose that is a Checkbox, TextBox, ItemsSource is a Hierachical collection object (each MapGroup object has a MapGroups property)
<Windows:HierarchicalDataTemplate x:Key="GroupTemplate" ItemTemplate="{StaticResource LayerTemplate}" ItemsSource="{Binding Path=MapGroups}">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" MouseRightButtonDown="StackPanelMouseRightButtonDown" Margin="10,0,10,0" >
<CheckBox IsTabStop="False" IsThreeState="False" IsChecked="{Binding IsVisible, Mode=TwoWay}"
Commands:Click.Command="{Binding TreeNodeClickCommand}" Margin="5,0,5,0"
Commands:Click.CommandParameter="{Binding ElementName=TreeViewControl, Path=SelectedItem}"
Click="CheckBoxClick" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Path=Name}" Width="120" Margin="0" VerticalAlignment="Center"/>
<Slider Minimum="0" Maximum="1" Width="100" Margin="10,0,10,0" Value="{Binding Opacity, Mode=TwoWay}"
Infrastructure:SliderValueChange.Command="{Binding OpacityChangeCommand}"/>
</StackPanel>
</StackPanel>
</Windows:HierarchicalDataTemplate>
Then my Treeview is setup like below
<Controls:TreeView x:Name="TreeViewControl" Background="{StaticResource MainPageBackgroundBrush}"
ItemTemplate="{StaticResource GroupTemplate}" ItemsSource="{Binding MapServiceLayers, Mode=TwoWay}"
FlowDirection="{Binding FlowDirection, Mode=TwoWay}" />
Hope that helps -Joe
... View more
06-01-2012
09:47 PM
|
0
|
0
|
1131
|
|
POST
|
The Graphic object has a MapTip property. Instead of creating a MapTip object and assigning the GraphicsLayer to the MapTip you create your own MapTip and set the MapTip property on the Graphic. Your custom MapTip can be any UserControl (you have to make the control). My code is just: graphic.MapTip = new MapTip(); And my MapTip is a UserControl and the bindings to attributes still work like below where; Name, Lat, Lon are all Attributes on my Graphic:
<StackPanel Orientation="Vertical" Margin="10,10,10,10">
<TextBlock Text="{Binding [Name]}" Width="120" Height="20" TextAlignment="Center"
FontWeight="SemiBold"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<Controls:Label Content="Lattitude:" Margin="0,0,8,0"/>
<TextBlock Text="{Binding [Lat]}" Width="60"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<Controls:Label Content="Longitude:" Margin="0,0,3,0"/>
<TextBlock Text="{Binding [Lon]}" Width="60"/>
</StackPanel>
</StackPanel>
... View more
06-01-2012
09:26 PM
|
0
|
0
|
813
|
|
POST
|
The same thing you see happens withe ArcGIS Online with their default settings in many areas (e.g, the Middle East), it is really a missing data issue like was pointed out.
... View more
06-01-2012
04:41 AM
|
0
|
0
|
613
|
|
POST
|
You can also add as a Graphic on a GraphicsLayer by placing a point and using a TextSymbol
... View more
06-01-2012
04:00 AM
|
0
|
0
|
343
|
|
POST
|
I would try to go back to the original setup you have for the MyFDG (the commented out version). Where you instantiate a new FeatureLayer in code
l = new FeatureLayer()
{
ID = "MyLayer",
Url = "http://myserver/ArcGIS/rest/services/Relate/FeatureServer/1",
Mode = FeatureLayer.QueryMode.Snapshot,
Where = "1=1"
}; Instead use (you don't need any of the Initialization handlers because it will already be initialized):
l = Map.Layers["RelatedFeatureLayer"]; I am assuming you have the 'RelatedFeatureLayer' as a FeatureLayer in your map (if not add it).
<esri:FeatureLayer ID="RelatedFeatureLayer" Url="http://myserver/ArcGIS/rest/services/Relate/FeatureServer/1" /> I would also be very interested to know (because it is something strange I have seen) what happens if you change your existing code (i.e., does update complete successfully):
//Modified initialzed method
l.Initialized += (s, e) =>
{
l.UpdateCompleted += UpdateCompleted;
l.UpdateFailed += UpdateFailed;
l.Update();
};
private void UpdateFailed(object sender, TaskFailedEventArgs e)
{
MessageBox.Show(e.Error.Message);
}
private void UpdateCompleted(object sender, EventArgs e)
{
MessageBox.Show("WooHoo!");
} Hope that helps -Joe
... View more
05-31-2012
08:44 PM
|
0
|
0
|
1241
|
|
POST
|
I am not sure about how dbroux application works but I would imagine it has to be similar to what the link I posted for the Imagery application. The imagery application does exactly what you want except it filters to only display Image Services in the tree (basically one conditional statement that would need to be removed). Get the catalog data from the server rest endpoint. If you put you services url (http://SERVER/arcgis/rest/services?f=json) you can see the json string try (http://SERVER/arcgis/rest/services?f=pjson) for something easier to read. The json can be converted to objects and the catalog built from there. Which is done in the application link I posted.
... View more
05-30-2012
08:47 PM
|
0
|
0
|
1174
|
|
POST
|
Attached is the code I have for doing Updates and Adds of related records. The way it works is that the user clicks on a point and the FeatureDataGrid will load with the related data. Then when the user clicks on a record the FeatureDataForm is loaded with that record. There is an Add button on the UI and when the user clicks it a new record is added to the FeatureLayer and the FeatureDataForm is populated with that record (containing default values for the particular data types of the field). A few notes about how the code is written. The application architecture is Modular (each application feature is in a Module) and use a MVVM design pattern. PRISM is used for modularity and to support commanding and event aggregation. The application also uses MEF for dependency injection. There is an object of type IMapViewUIService that is injected into the ViewModel which is used primarily to share the Map across Modules. Hence, the code would not be usable as as (unless you have a PRISM/MEF application that happens to have an IMapViewUIService :)), but I hope shows the code that takes care of everything. I tried to put enough comments in there to explain what is going on. This is the Xaml from my main page that has the FeatureLayer. As I have said in some other posts I have never got it to work for editing records when adding the FeatureLayer in code, don't know why but the Graphics never get loaded
<esri:Map x:Name="_map" Background="Transparent" WrapAround="true" IsLogoVisible="False">
<esri:ArcGISDynamicMapServiceLayer ID="Ad Soft"
Url="http://sdm7/ArcGIS/rest/services/Ad_Soft/MapServer" />
<esri:ArcGISDynamicMapServiceLayer ID="BaseLayer"
Url="http://sdm7/arcgis/rest/services/MapOverview/MapServer" />
<!-- FeatureLayer with Url of Related Table -->
<esri:FeatureLayer ID="Feature_Layer" Url="http://sdm7/ArcGIS/rest/services/Demos/Demo_RelatedDataEntry/FeatureServer/1" />
</esri:Map>
Hope it helps -Joe
... View more
05-30-2012
07:47 PM
|
0
|
0
|
1241
|
|
POST
|
That is ArcObjects it will not work in a Silverlight application.
... View more
05-30-2012
03:17 AM
|
0
|
0
|
1174
|
|
POST
|
This sample http://blogs.esri.com/esri/apl/2012/03/06/dynamic-image-service-directory/ builds a directory of Image Services which would be the same just don't filter out based on it being an Image Service. Basically you query the service catalog and get the json representation and parse that out into the Service names and associated urls. I myself wrote a rest service that connects from the server side and using ArcObjects gets the inventory and my Silverlight applications calls that service
... View more
05-30-2012
01:39 AM
|
0
|
0
|
1174
|
|
POST
|
Create a Geometry that has an Extent property from the MapPoints, a Polygon or MultiPoint should work. Then call Map::ZoomTo(your_geometry) GraphicsLayer:Graphics is a collection which can have items removed. When the Graphics are added create a temp collection of those graphics, then the next time add is called loop through that collection and remove them from the Graphics collection on GraphicsLayer You will need to draw these other symbols, by figuring out the coordinates based on the point. There is an Arrow type for standard drawing Another option would be to create a custom symbol using a ControlTemplate. Create a UserControl with what you want in the MapTip. Set the MapTip property on each graphic with the UserControl. The MapTip control is bound to the Attributes collection of the Graphic, so you use data binding to associate each attribute to the appropriate control in Xaml.
... View more
05-29-2012
11:21 PM
|
0
|
0
|
813
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2025 12:16 PM | |
| 1 | 10-19-2022 01:08 PM | |
| 1 | 09-03-2025 09:25 AM | |
| 1 | 04-16-2025 12:37 PM | |
| 1 | 03-18-2025 12:17 PM |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|