|
POST
|
I talked to another developer about this and he proposed to do the following: 1. In the ExtentChanged, if you are only concerned with the zoom, compare the map's previous resolution with its current resolution to rule out the pan because dragging the map also fires this event. 2. Before calling DistanceAsync, it might be a good idea to pass in Polyline instead of MapPoint and also using the map's center as the location and the map's resolution as length of Polyline. You can see the attached image. In this example, the old extent is the blue rectangle, the new extent is the red rectangle. You get each of their centers to dictate your Polyline's position. The length of these polylines will be the zoom factor (map units divided by pixels). Map units is the distance between your upper left and upper right corners and pixels is 300. It might be worth to try this approach too. Jennifer
... View more
08-11-2010
11:34 PM
|
0
|
0
|
1079
|
|
POST
|
Sure you can add/remove layer from your Map layers in code-behind, that will work too with minimal effort. If you will change visibility using CheckBox. You will have something like this: Visibility="{Binding IsChecked, ElementName=checkBox, Converter={StaticResource BooleanToVisibilityConverter}}" public class BooleanToVisibilityConverter : IValueConverter { public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { if (targetType == typeof(Visibility) && value !=null) { var visible = System.Convert.ToBoolean(value, culture); return visible ? Visibility.Visible : Visibility.Collapsed; } throw new InvalidOperationException("Converter can only convert to value of type Visibility."); } public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture) { throw new InvalidOperationException("Converter cannot convert back."); } } Jennifer
... View more
08-11-2010
10:47 PM
|
0
|
0
|
1194
|
|
POST
|
The Binding looks correct and it should work. Do your Graphics include Attributes? The Attributes will define the field names for the FeatureDataGrid. Do you show the rows and columns? What does your FeatureDataGrid display on GraphicsLayer MouseLeftButtonDown? Jennifer
... View more
08-11-2010
10:21 PM
|
0
|
0
|
1202
|
|
POST
|
Yes, you will need to create 2 Feature Layers, one for each geometry type. If you are using the same FeatureService for your query and display them on GraphicsLayer, yes you will also need to have the GraphicsLayer define its own MapTip. Because the MapTip on your FeatureLayer will not be activated since the graphics in the GraphicsLayer hides the features from the FeatureLayer clicked. Jennifer
... View more
08-11-2010
10:01 PM
|
0
|
0
|
548
|
|
POST
|
Thank you for reporting this. We are looking into it. Jennifer
... View more
08-11-2010
09:54 PM
|
0
|
0
|
618
|
|
POST
|
You can create two maps with layer events using the same event handlers in code and add/remove to your grid based on the CheckBox IsChecked property. Or you can define your maps in XAML and then bind each map's Visibility property to the CheckBox IsChecked, at which case you will need to write your own Converter. Jennifer
... View more
08-11-2010
09:52 PM
|
0
|
0
|
1194
|
|
POST
|
To debug, you can use Fiddler and investigate the web requests and responses there, so you'll know at which step it failed to load/initialize your layer. Jennifer
... View more
08-11-2010
08:32 PM
|
0
|
0
|
1237
|
|
POST
|
I think it would be easiest if your ComboBox ItemSource is bound to the FeatureLayer's graphics, that way when a feature name is selected, you can get the graphic from ComboBox selection and add it to a GraphicsLayer. Something like: <ComboBox ItemSource={Binding ElementName=MyMap, Path=Layers[FeatureLayerID].Graphics > <ComboBox.ItemTemplate> <DataTemplate> <TextBox Text={Binding Attributes[Name]>... Subscribe to the ComboBox SelectionChanged event and add this graphic to your GraphicsLayer. Your GraphicsLayer can be defined with a SimpleRenderer that has SimpleMarkerSymbol (Circle, Red) so you would only need to add graphic in code without worrying about its symbol. Jennifer
... View more
08-11-2010
06:32 AM
|
0
|
0
|
464
|
|
POST
|
The EditorWidget sets its own datacontext with an internal editor based on the properties you provide like Map, GeometryServiceUrl, Continuous, Layers, etc.. some of which are properties of the Editor as well. If you set just the EditorWidget's datacontext to the editor, all of their common properties will get their default value. The widget does not check if its datacontext has been set to an editor and populate its properties based on this. So if you would like an Editor defined as StaticResource, instead of setting EditorWidget's datacontext.. you can do GeometryServiceUrl={Binding Source={StaticResource MyEditor}, Path=GeometryServiceUrl}. In this case, you still need to grab the internal editor the EditorWidget created for itself to subscribe to its events. Jennifer
... View more
08-11-2010
06:23 AM
|
0
|
0
|
271
|
|
POST
|
In that case, you can supply the graphic maybe from MouseLeftButtonDown event, and then EditVertices.Execute(e.Graphic). I believe we pulled support for KmlLayer at this time for v2.0. But just the same, you can look at this thread for saving graphics layer:http://forums.arcgis.com/threads/1861-Saving-a-graphics-layer Jennifer
... View more
08-11-2010
06:14 AM
|
0
|
0
|
514
|
|
POST
|
You can listen to map's ExtentChanged event and use GeometryService Distance (see sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Distance) In the following code, I used only one MapPoint from each extent, the upper right corner, so I calculate the distance from the upper right corner of previous extent with the upper right corner of the new extent.
public MainPage()
{
InitializeComponent();
this.MyMap.ExtentChanged += new EventHandler<ExtentEventArgs>(MyMap_ExtentChanged);
gs = new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
gs.DistanceCompleted += new EventHandler<DistanceEventArgs>(gs_DistanceCompleted);
}
void gs_DistanceCompleted(object sender, DistanceEventArgs e)
{
double distanceInKm = e.Distance;
}
GeometryService gs;
void MyMap_ExtentChanged(object sender, ExtentEventArgs e)
{
if (e.OldExtent !=null && e.NewExtent != null)
{
gs.DistanceAsync(GetMapPoint(e.OldExtent), GetMapPoint(e.NewExtent), new DistanceParameters()
{
DistanceUnit = LinearUnit.Kilometer,
Geodesic = true
});
}
}
private MapPoint GetMapPoint(Envelope extent)
{
return new MapPoint() { SpatialReference = this.MyMap.SpatialReference, X = extent.XMax, Y = extent.YMax };
}
Jennifer
... View more
08-10-2010
11:14 PM
|
0
|
0
|
1079
|
|
POST
|
You can do the following:
DateTime dt = ((DateTimeOffset)g.Attributes["PublishDate"]).DateTime;
Jennifer
... View more
08-10-2010
10:01 PM
|
0
|
0
|
492
|
|
POST
|
You can look at this sample for guide: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#EditToolsExplicitSave You can also listen to the Editor's EditCompleted event and do the following to save edits:
void editor_EditCompleted(object sender, Editor.EditEventArgs e)
{
foreach (var edit in e.Edits)
{
if (e.Action== Editor.EditAction.EditVertices &&
edit.Layer is FeatureLayer)
{
(edit.Layer as FeatureLayer).SaveEdits();
}
}
}
edit also includes edit.Graphic so you will know which graphic was modified. Also, this is incorrect: EditVertices.Execute(graphic.Geometry) EditVertices command can accept graphic as parameter but not its geometry. Jennifer
... View more
08-10-2010
09:50 PM
|
0
|
0
|
514
|
|
POST
|
GraphicsLayer is TimeAware layer. For GeoRssLayer, it's PublishDate will be used as the TimeExtent. I'm not sure if we are using the same layer. I tried to view graphic attributes from this sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#GeoRssSimple and found that all graphics have the same PublishDate. This is the reason why the Temporal Renderer did not look like it worked because all of them have the same date. Jennifer
... View more
08-10-2010
09:38 PM
|
0
|
0
|
389
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-11-2025 01:30 PM | |
| 1 | 06-06-2025 10:14 AM | |
| 1 | 03-17-2025 09:47 AM | |
| 1 | 07-24-2024 07:32 AM | |
| 1 | 04-05-2024 06:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-03-2025
08:39 PM
|