|
POST
|
Hi, You should find a Source property on the GenerateRendererParamaters class: http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.GenerateRendererParameters_members.html. Cheers Mike
... View more
02-11-2013
11:37 PM
|
0
|
0
|
976
|
|
POST
|
Hi, Disabling the random prefix in the LocalServerUtility (or config file) does not introduce any other debugging activity but what it does mean is any application on the deployment machine could more easily find and interact with the RuntimeLocalServer instance by simply requesting the main url and trying different port numbers until it got the correct response. For this reason we added the random prefix to provide an additional level of security. However, this scenario would entail another application actively/maliciously looking for that URL to exploit. Whether you consider that a security risk is really up to you. Cheers Mike
... View more
02-07-2013
01:37 AM
|
0
|
0
|
1913
|
|
POST
|
Hi, The FullExtent property of the ArcGISLocalDynamicMapServiceLayer will not be alterred by any changes you make via the DynamicLayerInfos and LayerDrawingOptions properties - these define per request modification of the layers and layer rendering in the service. To determine the full extent of a specific layer you have two options: #1. Create a FeatureLayer and set the Source property with a LayerDataSource based on the new TableDataSource object you have created - this is the easiest approach.
// Create a new FeatureLayer instance passing in the local service.
FeatureLayer featureLayer = new FeatureLayer()
{
// Construct the URL to include the /dynamicLayer resource.
Url = localMapService.UrlMapService + "/dynamicLayer",
// Assign ID
ID = fileName,
// Display all fields
OutFields = new ESRI.ArcGIS.Client.Tasks.OutFields() { "*" },
// Yellow is generally a nice selection color
SelectionColor = new SolidColorBrush(Colors.Yellow),
};
// The workspace is a feature class so create a new TableDataSource
DataSource dataSource = new TableDataSource
{
// Match the DataSourceName to the physical filename on disk (excluding extension).
DataSourceName = fileName,
// Provide the WorkspaceID (the unique workspace identifier created earlier).
WorkspaceID = workspaceInfo.Id
};
// Set the Source property of the DynamicLayerInfo object.
LayerDataSource layerDataSource = new LayerDataSource { DataSource = dataSource };
// Assign the LayerDataSource
featureLayer.Source = layerDataSource;
#2. Construct a request which includes the JSON definition and use WebClient to make the request and download the response then parse it - more effort but more flexible. e.g.
// Create a new WebClient instance to make the request and download the response.
WebClient webClient = new WebClient();
// Register an asynchronous handler in which to create the renderers and apply the to the dynamic map service layer.
webClient.DownloadDataCompleted += (client, downloadDataEventArgs) =>
{
// Read the JSON response as XML
XmlReader reader = System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonReader(downloadDataEventArgs.Result, new XmlDictionaryReaderQuotas());
// Get the root XML element
XElement root = XElement.Load(reader);
// Query for the "geometryType" element
XElement geometryType = root.XPathSelectElement("//geometryType");
// Create the render based on the geometry type
switch (geometryType.Value)
{
case "esriGeometryPoint":
layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = new SolidColorBrush(GetRandomColor()), Size=8 } };
break;
case "esriGeometryPolyline":
layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleLineSymbol() { Color = new SolidColorBrush(GetRandomColor()) } };
break;
case "esriGeometryPolygon":
layerDrawOpt.Renderer = new SimpleRenderer() { Symbol = new SimpleFillSymbol() { Fill = new SolidColorBrush(GetRandomColor()), BorderBrush = new SolidColorBrush(GetRandomColor()) } };
break;
}
// Set the LayerDrawingOptions property on the local dynamic map service layer (the LayerID property ties this to the DynamicLayerInfo object).
layerDrawingOptionsCollection.Add(layerDrawOpt);
// Update the layer drawing options property on the dynamic map service layer.
arcGisLocalDynamicMapServiceLayer.LayerDrawingOptions = layerDrawingOptionsCollection;
// Need to refresh the layer after the renderer(s) have been applied.
arcGisLocalDynamicMapServiceLayer.Refresh();
};
// Make the request for the service metadata
// e.g. http://127.0.0.1:<PORT>/arcgis/rest/services/<MPK_NAME>/MapServer/dynamicLayer?layer={"id":0,"source":{"type":"dataLayer","dataSource":{"type":"table","workspaceId":"MyWorkspace","dataSourceName":"MyFeatureClassName"}}}
webClient.DownloadDataAsync(new Uri(arcGisLocalDynamicMapServiceLayer.Url
+ "/dynamicLayer?layer={'id':" + counter.ToString() + ","
+ "'source':{'type':'dataLayer','dataSource':{"
+ "'type':'table',"
+ "'workspaceId':'"+ workspaceInfo.Id + "',"
+ "'dataSourceName':'" + fileName + "'"
+ "}}}"));
We added a pair of new methods in 10.1.1: ArcGISLocalDynamicMapServiceLayer.GetDetails(int layer ID) and ArcGISLocalDynamicMapServiceLayer.GetAllDetails() which return either a single FeatureLayerInfo object or a collection of FeatureLayerInfo objects, one for each of the layers in the map service. However, these methods do not currently honour any dynamic layer changes you have made. This is on the roadmap for a future release. Cheers Mike
... View more
02-01-2013
01:25 AM
|
0
|
0
|
589
|
|
POST
|
Hi, Unfortunately we didn't manage to add an Angle property to PictureMarkSymbol in the last release - it's on the roadmap for a future release. Are you looking to rotate the symbols to quite specific angles, or would you like to rotate based on an attribute value? If it's the former case, then one to easily achieve this is to programmatically rotate the image and pass that in as the source of the PictureMarkerSymbol image. An extension of this approach is to actually construct the symbols dynamically and then render as images using RenderTargetBitmap and use that as the source of the PictureMarkerSymbol image. For example:
// Create a diagonal linear gradient with four stops.
// http://msdn.microsoft.com/en-us/library/system.windows.media.lineargradientbrush.aspx
LinearGradientBrush myLinearGradientBrush =
new LinearGradientBrush();
myLinearGradientBrush.StartPoint = new Point(0, 0);
myLinearGradientBrush.EndPoint = new Point(1, 1);
myLinearGradientBrush.GradientStops.Add(
new GradientStop(Colors.Yellow, 0.0));
myLinearGradientBrush.GradientStops.Add(
new GradientStop(Colors.Red, 0.25));
myLinearGradientBrush.GradientStops.Add(
new GradientStop(Colors.Blue, 0.75));
myLinearGradientBrush.GradientStops.Add(
new GradientStop(Colors.LimeGreen, 1.0));
// Create an Ellipse Element
// http://msdn.microsoft.com/en-us/library/system.windows.shapes.ellipse.aspx
Ellipse myEllipse = new Ellipse();
myEllipse.Stroke = System.Windows.Media.Brushes.Black;
myEllipse.Fill = myLinearGradientBrush;
myEllipse.HorizontalAlignment = HorizontalAlignment.Left;
myEllipse.VerticalAlignment = VerticalAlignment.Center;
myEllipse.Width = 12;
myEllipse.Height = 25;
//Force render
myEllipse.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
myEllipse.Arrange(new Rect(myEllipse.DesiredSize));
// Render to an bitmap
// http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.rendertargetbitmap.aspx
RenderTargetBitmap render = new RenderTargetBitmap(200, 200, 150, 150, PixelFormats.Pbgra32);
render.Render(myEllipse);
// Use the bitmap as the source for a PMS
_pms = new PictureMarkerSymbol()
{
Source = render,
};
#. The following code would be run in a loop when creating multiple graphics:
graphic.Symbol = _pms;
In the latter case you could still use the above approach but it would incur an additional level of overhead because the potential for image reuse in the display is significantly reduced. Perhaps you could also consider combining the above approach with a UniqueValueRender or ClassBreaksRender, with the symbol for each value/classbreak being a PictureMarkerSymbol. Cheers Mike
... View more
02-01-2013
12:30 AM
|
0
|
0
|
1068
|
|
POST
|
Hi, Unfortunately you've downloaded the old ArcGIS API for WPF (v2.4). Back in July we rolled this into a larger product with support for local data called the ArcGIS Runtime SDK for WPF. That was the v1.0 release of the SDK, although it included v3.0 of the client dlls. In January we released the second version of this SDK, with everything now labelled v10.1.1 to indicate commonality with the rest of the ArcGIS system. To download the latest SDK you'll need an Esri Developer Network (EDN) subscription which you can then use to sign into the customer care portal and download the software along with dev/test licenses. EDN info: http://edn.esri.com/ Software download: http://customers.esri.com/ Cheers Mike
... View more
01-31-2013
11:06 PM
|
0
|
0
|
1722
|
|
POST
|
Hi, If you open Windows Explorer and browse to the client dll folder (C:\Program Files (x86)\ArcGIS SDKs\WPF10.1.1\sdk\bin) is there an ESRI.ArcGIS.Client.Local.dll in that folder? If not that sounds quite unusual - I'd suggest running a repair of the setup. Cheers Mike
... View more
01-31-2013
12:01 AM
|
0
|
0
|
1722
|
|
POST
|
Hi, It still seems to be two different audiences to me - one, a developer audience which could embed your components into their own custom line-of-business applications, and the other, an end-user/beginner-developer audience which could use your controls within an Add-In they have developed for ArcGIS Explorer as part of their organizational roll out out of lightweight GIS? The decision probably depends on which of those you think the majority of your audience are. Cheers Mike
... View more
01-29-2013
04:31 AM
|
0
|
0
|
1023
|
|
POST
|
Hi, WFS and WFS-T support is not on the immediate roadmap, but please submit the request over at http://ideas.arcgis.com/ideaList?category=ArcGIS+Runtime. We regularly review the ideas site and try to factor the enhancement requests into our development plan. Cheers Mike
... View more
01-29-2013
02:40 AM
|
0
|
0
|
862
|
|
POST
|
Hi, In OnDemand mode the FeatureLayer should be retrieving features for the map extent, which means you will have some duplication of content in the map. It would probabaly be better to set the FeatureLayer to SelectionOnly mode if you're using the dynamic map service layer for display purposes. In that case, only the features you select on the map will be displayed in the FeatureDataGrid. Here's an example in SL: http://resources.arcgis.com/en/help/silverlight-api/samples/start.htm#AttributeOnlyEditing (sorry - we haven't had time to port to WPF yet). Regarding the selection issue - are you setting the Map property of the Editor in XAML? You'll need to set the Editor.Map after InitializeComponent() because WPF element-binding does not resolve when part of resource. Cheers Mike
... View more
01-29-2013
02:02 AM
|
0
|
0
|
4123
|
|
POST
|
Hi, You should only need to pass the FeatureLayer to the GraphicsLayer property of the FeatureDataGrid (FeatureLayer derives from GraphicsLayer) e.g.: MyDataGrid.GraphicsLayer = myFeatureLayer Cheers Mike
... View more
01-29-2013
01:49 AM
|
0
|
0
|
1242
|
|
POST
|
Hi, The ArcGIS Runtime products are very different from ArcGIS Explorer, which is really why we have not produced a comparison sheet. The ArcGIS Runtime products are developer SDKs. Taking the "ArcGIS Runtime SDK for WPF" as an example (you posted in the WPF forum), it's a developer SDK which enables you to build your own custom WPF desktop applications for deploying on the Windows platform with embedded mapping and spatial functionality. ArcGIS Explorer by contrast is a fully functional desktop application for consuming and "exploring" geographic content yet it still provides a developer SDK allowing you to tailor the functionality to you own needs. However, you're always working within the application framework of ArcGIS Explorer. That's really the main difference to understand. In theory, you could use the ArcGIS Runtime SDK for WPF to build a product like ArcGIS Explorer, although there are some features we're still need to iplement such as 3D and better support for KML. If you're looking for an application framework which you can extend, we've recently released the new Operations Dashboard for ArcGIS. This application works primarily with online services via WebMaps - for more information please see http://resources.arcgis.com/en/help/operations-dashboard/index.html#//02m70000000q000000. In the recent 10.1.1 release of the ArcGIS Runtime SDK for WPF we have included an API for building custom widgets for your Operation Dashboards. Cheers Mike
... View more
01-29-2013
01:45 AM
|
0
|
0
|
1023
|
|
POST
|
Hi, sorry to hear you're having trouble, the VS2010 templates should have installed ok. I've uploaded them and attached to this post. The Zip files should be copied as outlined below then you can run the command devenv.exe /InstallVSTemplates to register the templates with Visual Studio. #. ArcGISMapAppCSharp.zip => C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Windows\ArcGIS\Runtime SDK 10.1.1 for WPF #. ArcGISMapAppVBNET.zip => C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\VisualBasic\Windows\ArcGIS\Runtime SDK 10.1.1 for WPF devenv.exe /InstallVSTemplates (http://msdn.microsoft.com/en-us/library/ms241279(v=vs.100).aspx) Cheers Mike
... View more
01-29-2013
01:32 AM
|
0
|
0
|
1387
|
|
POST
|
Hi, When using on the AcceleratedDIsplayLayers group, you can specify an MGRS grid as follows: <esri:Map UseAcceleratedDisplay="False" x:Name="MyMap"> <esri:AcceleratedDisplayLayers> <esri:AcceleratedDisplayLayers.AcceleratedDisplay> <esri:AcceleratedDisplaySettings GridType="MGRS"/> </esri:AcceleratedDisplayLayers.AcceleratedDisplay> <esri:ArcGISTiledMapServiceLayer ID="World Topo Map" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/> <esri:MessageLayer SymbolDictionaryType="Mil2525C" x:Name="MilitaryLayer"></esri:MessageLayer> </esri:AcceleratedDisplayLayers> <esri:ElementLayer></esri:ElementLayer> </esri:Map> Note that in your example you were enabling the entire map as accelerated AND creating an accelerated group layer. I'm also keen to hear what you plan to use the ElementLayer for. Cheers Mike
... View more
01-28-2013
04:48 AM
|
0
|
0
|
992
|
|
POST
|
Hi, #. Bing Hybrid - Yes this works fine in the 10.1.1 release in both the standard WPF map display and when using the accelerated display mode. #. KML in the accelerated display mode - Unfortunately we were not able to support KML in the accelerated display mode at the 10.1.1 release because it makes use of ElementLayers for rendering some of the more complex aspects. Support for KML in the accelerated display mode is on the roadmap for a future release (timescale TBC). For now, if working with KML, you should use the AcceleratedDisplayLayers group layer to render the majority of your layers and just add KML to the map outside this group. Cheers Mike
... View more
01-28-2013
12:04 AM
|
0
|
0
|
787
|
|
POST
|
Hi, I had a revelation that actually I'd probably confused the issue by keeping the ArcGISDynamicMapServiceLayer in my example whilst introducing a FeatureLayer as well. So I've simplified it to just use a FeatureLayer (below). So it now assumes that you actually want to add the FeatureLayer to the map and display that instead of the ArcGISDynamicMapServiceLayer. I'd recommend you definitely use the accelerated display mode if the feature layer may contain many thousands of graphics, or graphics with complex polygons. Code:
/// <summary>
/// Interaction logic for DynamicLayersFeatureDataGrid.xaml
/// </summary>
public partial class DynamicLayersFeatureDataGrid : UserControl
{
// Get the path of the "empty" MPK from the application folder
string _emptyMpkPath = @"..\Data\DynamicLayers\EmptyMPK_WGS84.mpk";
public DynamicLayersFeatureDataGrid()
{
InitializeComponent();
MyDataGrid.SelectionChanged += (s3, e3) =>
{
foreach (Graphic graphic in e3.RemovedItems)
{
graphic.SetZIndex(0);
}
foreach (Graphic graphic in e3.AddedItems)
{
graphic.SetZIndex(1);
}
};
}
/// <summary>
/// Handles the Click event of the AddShapefileButton control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
private void AddShapefileButton_Click(object sender, RoutedEventArgs e)
{
// Setup the OpenFiledialog.
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Shapefiles (*.shp)|*.shp";
openFileDialog.RestoreDirectory = true;
openFileDialog.Multiselect = false; // This sample assumes a single file is selected
if (openFileDialog.ShowDialog() == true)
{
try
{
// Remove any existing FeatureLayers in the Map
List<FeatureLayer> featureLayers = MyMap.Layers.OfType<FeatureLayer>().ToList();
foreach (var fl in featureLayers)
{ MyMap.Layers.Remove(fl); }
// Call the add dataset method with workspace type, parent directory path, file names (without extensions) and delegate.
AddFileDatasetToDynamicMapServiceLayer(WorkspaceFactoryType.Shapefile,
Path.GetDirectoryName(openFileDialog.FileName),
Path.GetFileNameWithoutExtension(openFileDialog.SafeFileName));
}
catch (Exception ex)
{
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
}
}
}
/// <summary>
/// Adds a file dataset (Shapefile) to a new feature layer.
/// </summary>
/// <param name="workspaceType">The workspace type (FileGDB, Raster, SDE, Shapefile) <see cref="http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client.Local~ESRI.ArcGIS.Client.Local.WorkspaceFactoryType.html"/>.</param>
/// <param name="directoryPath">A <see cref="System.String"/> representing the directory path.</param>
/// <param name="fileNames">A <see cref="System.Collections.Generic.List{System.String}"/> representing the name of the file.</param>
public void AddFileDatasetToDynamicMapServiceLayer(WorkspaceFactoryType workspaceType, string directoryPath, string fileName)
{
try
{
// Generate a unique workspace ID (any unique string).
string uniqueId = Guid.NewGuid().ToString();
// Create a new WorkspaceInfo object with a unique ID.
WorkspaceInfo workspaceInfo = new WorkspaceInfo(uniqueId, workspaceType, "DATABASE=" + directoryPath);
// Create a new LocalMapService instance.
LocalMapService localMapService = new LocalMapService
{
Path = _emptyMpkPath, // Set the path property.
EnableDynamicLayers = true, // Enable the dynamic layers capability.
MaxRecords = 1000000, // Set the maximum number of records
};
// Register the workspace to be used with this service.
localMapService.DynamicWorkspaces.Add(workspaceInfo);
// Asynchronously start the local map service.
localMapService.StartAsync(x =>
{
// Create a new ArcGISLocalDynamicMapServiceLayer passing in the newly started local service.
FeatureLayer featureLayer = new FeatureLayer()
{
Url = localMapService.UrlMapService + "/dynamicLayer", // Construct the URL to include the /dynamicLayer resource.
ID = fileName, // Assign ID
OutFields = new ESRI.ArcGIS.Client.Tasks.OutFields() { "*" }, // Display all fields
SelectionColor = new SolidColorBrush(Colors.Yellow), // Yellow is generally a nice selection color
};
// The workspace is a feature class so create a new TableDataSource
DataSource dataSource = new TableDataSource
{
DataSourceName = fileName, // Match the DataSourceName to the physical filename on disk (excluding extension).
WorkspaceID = workspaceInfo.Id // Provide the WorkspaceID (the unique workspace identifier created earlier).
};
// Set the Source property of the DynamicLayerInfo object.
LayerDataSource layerDataSource = new LayerDataSource { DataSource = dataSource };
// Assign the LayerDataSource
featureLayer.Source = layerDataSource;
featureLayer.Initialized += (s, e) =>
{
// Set the FeatureDataGrid's Map property
MyDataGrid.Map = MyMap;
// Set the new FeatureLayer as the FeatureDataGrid's GraphicsLayer property
MyDataGrid.GraphicsLayer = featureLayer as GraphicsLayer;
SimpleRenderer renderer = null;
switch (featureLayer.LayerInfo.GeometryType)
{
case ESRI.ArcGIS.Client.Tasks.GeometryType.MultiPoint:
renderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = new SolidColorBrush(GetRandomColor()), Size = 8 } };
break;
case ESRI.ArcGIS.Client.Tasks.GeometryType.Point:
renderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = new SolidColorBrush(GetRandomColor()), Size = 8 } };
break;
case ESRI.ArcGIS.Client.Tasks.GeometryType.Polygon:
renderer = new SimpleRenderer() { Symbol = new SimpleFillSymbol() { Fill = new SolidColorBrush(GetRandomColor()), BorderBrush = new SolidColorBrush(GetRandomColor()) } };
break;
case ESRI.ArcGIS.Client.Tasks.GeometryType.Polyline:
renderer = new SimpleRenderer() { Symbol = new SimpleLineSymbol() { Color = new SolidColorBrush(GetRandomColor()) } };
break;
default:
break;
}
featureLayer.Renderer = renderer;
};
MyMap.Layers.Add(featureLayer);
});
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
// Utility function: Generate a random System.Windows.Media.Color
Random _random = new Random();
private Color GetRandomColor()
{
var colorBytes = new byte[3];
_random.NextBytes(colorBytes);
Color randomColor = Color.FromRgb(colorBytes[0], colorBytes[1], colorBytes[2]);
return randomColor;
}
private void Legend_Refreshed(object sender, Legend.RefreshedEventArgs e)
{
// Clear the sub items from the basemap layer.
if (e.LayerItem.Layer == _worldTopographicBasemap)
e.LayerItem.LayerItems.Clear();
}
}
Sorry - I haven't had time to look at the code in your previous yet... it's the end of the week here... Cheers Mike
... View more
01-25-2013
06:36 AM
|
0
|
0
|
4123
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-14-2026 05:04 AM | |
| 1 | 02-20-2024 07:02 AM | |
| 1 | 01-19-2026 06:44 AM | |
| 1 | 12-10-2025 07:16 AM | |
| 1 | 11-21-2025 08:12 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-02-2026
06:07 AM
|