|
POST
|
When you create QueryParameter, do you set one of these properties: WhereClause, Geometry, ObjectIds? At least one of these is required by the service. Or do you only set MaxFeatures? I'm not able to reproduce with the following code unless I remove setting of WhereClause, then I'll get this error as expected. {"error":{"code":400,"message":"Unable to complete operation.","details":["Unable to perform query operation."]}} public MainWindow()
{
InitializeComponent();
MyMapView.Map = new Map(Basemap.CreateStreets());
MyMapView.Map.OperationalLayers.Add(new FeatureLayer(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/0")));
}
private async void OnClick(object sender, RoutedEventArgs e)
{
var table = (ServiceFeatureTable)((FeatureLayer)MyMapView.Map.OperationalLayers[0]).FeatureTable;
var query = new QueryParameters() { WhereClause = "1=1" };
query.MaxFeatures = 50;
var results = await table.QueryFeaturesAsync(query, QueryFeatureFields.LoadAll);
}
... View more
06-16-2017
02:18 PM
|
0
|
1
|
1046
|
|
POST
|
What version of the API are you using? I'm not able to reproduce with released version v100 with the following code. To use, hit "Enter" key to execute update on FeatureLayer.DefinitionExpression, should only display states that begin with 'N' Clearing the text and hit "Enter" again, should display all states. I'm able to update the definition expression without issue. Can you share some repro code or try code below to see if you can get the an exception? Thanks. xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid>
<esri:MapView x:Name="MyMapView" />
<StackPanel VerticalAlignment="Top"
HorizontalAlignment="Right">
<TextBox Text="STATE_NAME LIKE 'N%'"
Width="250"
KeyUp="OnKeyUp"/>
</StackPanel>
</Grid> public MainWindow()
{
InitializeComponent();
MyMapView.Map = new Map(Basemap.CreateTopographic());
MyMapView.Map.OperationalLayers.Add(new FeatureLayer(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3")));
}
private void OnKeyUp(object sender, KeyEventArgs e)
{
if(e.Key == Key.Enter)
{
var clause = ((TextBox)sender).Text.Trim();
var layer = (FeatureLayer)MyMapView.Map.OperationalLayers[0];
layer.DefinitionExpression = clause;
}
}
... View more
06-16-2017
11:24 AM
|
0
|
4
|
1706
|
|
POST
|
You can subscribe to DrawStatusChanged to be able to grab the image when all layers are rendered. EventHandler<DrawStatusChangedEventArgs> onDrawStatusChanged = null;
private async void OnSetView(object sender, RoutedEventArgs e)
{
try
{
MyMapView.DrawStatusChanged -= onDrawStatusChanged;
var geometry = await MyMapView.SketchEditor.StartAsync(SketchCreationMode.Rectangle, false);
await MyMapView.SetViewpointGeometryAsync(geometry);
onDrawStatusChanged = async (s, a) =>
{
if (a.Status == DrawStatus.Completed)
{
MyMapView.DrawStatusChanged -= onDrawStatusChanged;
var image = await MyMapView.ExportImageAsync();
new Window() { Content = new Image() { Source = await image.ToImageSourceAsync() } }.ShowDialog();
}
};
MyMapView.DrawStatusChanged += onDrawStatusChanged;
}
catch(TaskCanceledException)
{
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
... View more
06-06-2017
02:35 PM
|
0
|
0
|
1556
|
|
POST
|
Hi Xiaguang, You might be hitting some of the expected behavior changes with SketchEditor. SketchEditor.StartAsync(SketchCreationMode.Rectangle) is equivalent to var geometry = await Editor.RequestShapeAsync(DrawShape.Rectangle);
geometry = await Editor.EditGeometryAsync(geometry); Unless you specify optional parameter drawAndShape to false (default value: true), your draw will continue in edit mode. You can also complete draw/edit using CompleteCommand just as before Using command binding <Button Content="Complete"
Command="{Binding ElementName=MyMapView, Path=SketchEditor.CompleteCommand}" /> or programmatically invoking command if (MyMapView.SketchEditor.CompleteCommand.CanExecute(null))
MyMapView.SketchEditor.CompleteCommand.Execute(null); To move the geometry, you tap on the outline of polyline/polygon while in edit mode. Once outline is highlighted, you can drag the feature just as before. In 10.2.x, you may drag the feature right away but this may have caused unintentional edit (moved vertices/geometry by mistake). You also may complete interactively by tapping the geometry but this may have caused unintentional completion and also did not allow a vertex be added inside the geometry. As Morten mentioned, there are default configurations in SketchEditConfiguration. You may have noticed that AllowVertexEditing is only enabled by default for SketchCreationMode.Polyline/Polygon or Polygon/Polyline geometry but AllowMove should be enabled for all types and you should be able to override default edit configuration. I hope that works. Please let us know, otherwise. Thanks.
... View more
06-02-2017
05:34 PM
|
0
|
1
|
3727
|
|
POST
|
By custom attributes, do you mean the service does not define these fields? Are you working with ServiceFeatureTable? If yes, there is a LoadAll that will return all fields defined by service, the other QueryFeatures method will return minimum set of attributes (i.e. objectIdField, typeIdField, fields used for rendering, etc.) https://developers.arcgis.com/net/latest/wpf/api-reference//html/T_Esri_ArcGISRuntime_Data_QueryFeatureFields.htm
... View more
04-25-2017
03:10 PM
|
1
|
5
|
2688
|
|
POST
|
I was able to reproduce "Not found: Field does not exist." only if TableName is accessed before layer is added to map with v100.0. Note also that TableName is null until table is loaded. However, I'm not able to reproduce this with latest version of the sdk so bug have been fixed in the upcoming update. The following code should also apply with Xamarin.Forms. You can replace MessageBox with DisplayAlert and use different path to geodatabase. InitialViewpoint and subscription to LayerViewStateChanged were added to show that there seems to be no problem loading and rendering your data. public MainWindow()
{
InitializeComponent();
MyMapView.LayerViewStateChanged += MyMapView_LayerViewStateChanged;
MyMapView.Map = new Map()
{
InitialViewpoint = new Viewpoint(new Envelope(665409.625723681, 7183296.13943517, 680649.625739226, 7191217.76444325, new SpatialReference(29192)))
};
}
private void MyMapView_LayerViewStateChanged(object sender, LayerViewStateChangedEventArgs e)
{
var error = e.Layer?.LoadError ?? e.LayerViewState.Error;
if (error != null)
MessageBox.Show(error.Message);
if (e.LayerViewState.Status == LayerViewStatus.Active)
MessageBox.Show($"{e.Layer.Name} is now active.");
}
private async void Open_Click(object sender, RoutedEventArgs e)
{
try
{
var geodatabase = await Geodatabase.OpenAsync(@"C:\asegeo\asegeo.geodatabase");
var sb = new StringBuilder();
foreach (var table in geodatabase.GeodatabaseFeatureTables)
{
await table.LoadAsync();
sb.AppendLine($"Adding {table.TableName} with {table.NumberOfFeatures} features to map.");
MyMapView.Map.OperationalLayers.Add(new FeatureLayer(table));
}
MessageBox.Show(sb.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} Interestingly, re-ordering line#'s 29-30 above to below also works even in v100.0. Will this workaround be good for you meanwhile? MyMapView.Map.OperationalLayers.Add(new FeatureLayer(table));
await table.LoadAsync();
sb.AppendLine($"Adding {table.TableName} with {table.NumberOfFeatures} features to map."); Thanks.
... View more
04-18-2017
03:15 PM
|
0
|
0
|
1565
|
|
POST
|
Hi Chad, As for the GUIDs, it is by design that runtime APIs store them in upper-case. While this specific service may have Postgres back-end database, which would make them lower-case, the upper-case string comparison query will still work on server-side. You're right, ManualCache imports features and will not get overwritten until you call PopulateFromServiceAsync with clearCache=true. I was thinking since this is a non-spatial table, interaction with the map which could trigger query based on current view wouldn't be helpful. But since we are doing the query with where clause here, any of these FeatureRequestMode would still work. You can choose whichever works best for you. You can use QueryFeatureFields to specify whether to return all fields, minimum set of fields or ids only. This should be equivalent to returning "*" all fields. var parameters = new QueryParameters()
{
WhereClause = $"ManholeNumber ='{{{g.Attributes[globalIdField]?.ToString()?.ToUpper()}}}'"
};
if (_table == null)
{
_table = new ServiceFeatureTable(new Uri("http://services6.arcgis.com/v1B7paWSaOfBIIVv/ArcGIS/rest/services/ManholeInspections/FeatureServer/1"));
// Or keep default FeatureRequstMode.OnInteractionCache.
_table.FeatureRequestMode = FeatureRequestMode.OnInteractionNoCache;
await _table.LoadAsync();
}
var relatedFeatures = await _table.QueryFeaturesAsync(parameters, QueryFeatureFields.LoadAll);
... View more
04-06-2017
10:09 AM
|
1
|
1
|
3138
|
|
POST
|
You're welcome. I'm still trying to get an answer as to why we have chosen to store GUIDs in uppercase so I'll have to get back on you on that. Another way is to compare them as Guid. Both PopulateFromServiceAsync and QueryFeatures will return IEnumerable<Features> so using Linq query you can compare the attribute value this way. var features = await _table.PopulateFromServiceAsync(new QueryParameters() { WhereClause = "1=1" }, true, new string[] { "*" });
var relatedFeature = features.FirstOrDefault(f => (Guid)f.Attributes["ManholeNumber"] == (Guid)g.Attributes[globalIdField]);
... View more
04-05-2017
03:37 PM
|
0
|
4
|
3135
|
|
POST
|
You can use OffsetX property of MarkerSymbol. In the sample below, graphics share the same geometry, which is the tapped location, but x offset is added to the symbol for the succeeding graphics. xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid>
<esri:MapView x:Name="MyMapView" GeoViewTapped="MyMapView_GeoViewTapped"/>
</Grid> public MainWindow()
{
InitializeComponent();
MyMapView.Map = new Map(Basemap.CreateTopographic());
MyMapView.GraphicsOverlays.Add(new GraphicsOverlay());
}
private void MyMapView_GeoViewTapped(object sender, GeoViewInputEventArgs e)
{
var mp = e.Location;
var overlay = MyMapView.GraphicsOverlays[0];
for (int i = 0; i < 5; i++)
{
var sms = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Colors.Red, 10d);
sms.OffsetX = sms.Size * i;
overlay.Graphics.Add(new Graphic(mp, sms));
}
}
... View more
04-05-2017
03:01 PM
|
0
|
0
|
1358
|
|
POST
|
Related Tables are coming soon so hopefully you can take advantage of that when it comes out. Meanwhile, you can try the following code where spatial table is added to the map and non-spatial table is populated upfront. You can use GeoViewTapped to get the feature of interest and retrieve its 'GlobalId'. Based on service metadata, the non-spatial table is related by 'ManholeNumber' field just as you had in your code. The only difference is GUIDs are stored in uppercase. This doesn't really mimic the queryRelated request in arcgis.com but should return the same feature you would expect. xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid>
<esri:MapView x:Name="MyMapView" GeoViewTapped="MyMapView_GeoViewTapped"/>
</Grid> public MainWindow()
{
InitializeComponent();
MyMapView.Map = new Map(Basemap.CreateTopographic());
MyMapView.Map.OperationalLayers.Add(new FeatureLayer(new Uri("http://services6.arcgis.com/v1B7paWSaOfBIIVv/ArcGIS/rest/services/ManholeInspections/FeatureServer/0")));
}
ServiceFeatureTable _table;
private async void MyMapView_GeoViewTapped(object sender, GeoViewInputEventArgs e)
{
var result = await MyMapView.IdentifyLayersAsync(e.Position, 1, false, 1);
foreach (var r in result)
{
var globalIdField = ((r.LayerContent as FeatureLayer)?.FeatureTable as ArcGISFeatureTable)?.GlobalIdField;
if (string.IsNullOrEmpty(globalIdField))
continue;
foreach (var g in r.GeoElements)
{
var parameters = new QueryParameters()
{
WhereClause = $"ManholeNumber='{{{g.Attributes[globalIdField]?.ToString()?.ToUpper()}}}'"
};
if (_table == null)
{
_table = new ServiceFeatureTable(new Uri("http://services6.arcgis.com/v1B7paWSaOfBIIVv/ArcGIS/rest/services/ManholeInspections/FeatureServer/1"))
{
FeatureRequestMode = FeatureRequestMode.ManualCache
};
await _table.PopulateFromServiceAsync(new QueryParameters() { WhereClause = "1=1" }, true, new string[] { "*" });
}
var relatedFeatures = await _table.QueryFeaturesAsync(parameters);
}
}
... View more
04-05-2017
02:37 PM
|
1
|
6
|
3135
|
|
POST
|
However, when I add layers from a MobileMapPackage, it doesn't want to fire properly at all. Are you removing the layer from the MobileMapPackage.Map before adding to your MapView.Map? It might be that you are getting "Object already owned" error and the layer from mobile map package is never added to the map? If you would like to know the state for each layer added, you can use LayerViewStateChanged, it also has Error property that you can check. You can try the following code which reports status from both events. Load button will add layers from mobile map package. I assume, this is what you're trying to do? xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid>
<esri:MapView x:Name="MyMapView"
DrawStatusChanged="MyMapView_DrawStatusChanged"
LayerViewStateChanged="MyMapView_LayerViewStateChanged">
<esri:Map>
<esri:ArcGISMapImageLayer Source="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer" />
</esri:Map>
</esri:MapView>
<StackPanel VerticalAlignment="Top"
HorizontalAlignment="Right">
<Button Content="Load"
Click="Button_Click" />
<ListView x:Name="Status" />
</StackPanel>
</Grid> public MainWindow()
{
InitializeComponent();
Status.ItemsSource = _status;
}
private ObservableCollection<string> _status = new ObservableCollection<string>();
private void MyMapView_DrawStatusChanged(object sender, Esri.ArcGISRuntime.UI.DrawStatusChangedEventArgs e)
{
_status.Add($"MyMapView_DrawStatusChanged:\t{e.Status}");
}
private void MyMapView_LayerViewStateChanged(object sender, LayerViewStateChangedEventArgs e)
{
_status.Add($"MyMapView_LayerViewStateChanged:\t{e.Layer.Name}:\t{e.LayerViewState.Status}");
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
var mmpk = await MobileMapPackage.OpenAsync(@"C:\Temp\sanfrancisco.mmpk");
foreach (var layer in mmpk.Maps[0].Basemap.BaseLayers.ToList())
{
mmpk.Maps[0].Basemap.BaseLayers.Remove(layer);
MyMapView.Map.Basemap.BaseLayers.Add(layer);
}
foreach (var layer in mmpk.Maps[0].OperationalLayers.ToList())
{
mmpk.Maps[0].OperationalLayers.Remove(layer);
MyMapView.Map.OperationalLayers.Add(layer);
}
}
... View more
03-31-2017
10:20 AM
|
0
|
0
|
1213
|
|
POST
|
This should work in v100. What event are you using and what's e.GetPosition(MainMapView)'s value when you get this error? var position = e.GetPosition(MainMapView);
System.Diagnostics.Debug.WriteLine(position.ToString()); You can also try the following code. Using GeoViewTapped, you can pass either specific layer or identify all layers. In the identified result, notice that ArcGISMapImageLayer have results in SublayerResults and FeatureLayer have results in GeoElements. xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid>
<esri:MapView x:Name="MyMapView" GeoViewTapped="MyMapView_GeoViewTapped">
<esri:Map>
<esri:ArcGISMapImageLayer Source="http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer" />
<esri:FeatureLayer>
<esri:ServiceFeatureTable Source="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Notes/FeatureServer/0" />
</esri:FeatureLayer>
</esri:Map>
</esri:MapView>
</Grid> private async void MyMapView_GeoViewTapped(object sender, GeoViewInputEventArgs e)
{
try
{
Layer layer = null;
layer = MyMapView.Map.AllLayers.OfType<ArcGISMapImageLayer>().FirstOrDefault();
var identifyResult = await MyMapView.IdentifyLayerAsync(layer, e.Position, 1, false, 1);
DisplayResult(identifyResult); // results in SublayerResults
layer = MyMapView.Map.AllLayers.OfType<FeatureLayer>().FirstOrDefault();
identifyResult = await MyMapView.IdentifyLayerAsync(layer, e.Position, 1, false, 1);
DisplayResult(identifyResult); // results in GeoElements
var identifyResults = await MyMapView.IdentifyLayersAsync(e.Position, 1, false, 1);
foreach (var result in identifyResults)
DisplayResult(result);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private string GetGeoElements(IEnumerable<GeoElement> geoElements)
{
var sb = new StringBuilder();
foreach (var g in geoElements)
foreach (var a in g.Attributes)
sb.AppendLine($"{a.Key}={a.Value}");
return sb.ToString();
}
private string GetSublayerResult(IEnumerable<IdentifyLayerResult> sublayerResults)
{
var sb = new StringBuilder();
foreach (var r in sublayerResults)
{
sb.AppendLine($"{r.LayerContent.Name} has {r.GeoElements.Count} results");
var summary = GetGeoElements(r.GeoElements);
if (!string.IsNullOrEmpty(summary))
sb.AppendLine(summary);
}
return sb.ToString();
}
private void DisplayResult(IdentifyLayerResult result)
{
var sb = new StringBuilder();
var summary = GetGeoElements(result.GeoElements);
if (!string.IsNullOrEmpty(summary))
sb.AppendLine(summary);
summary = GetSublayerResult(result.SublayerResults);
if (!string.IsNullOrEmpty(summary))
sb.AppendLine(summary);
summary = sb.ToString();
if(!string.IsNullOrEmpty(summary))
MessageBox.Show(summary);
}
... View more
03-30-2017
04:03 PM
|
1
|
2
|
2020
|
|
POST
|
Can you share the input geometries? I'm unable to reproduce with the following code: var geom1 = Esri.ArcGISRuntime.Geometry.Geometry.FromJson("{\"rings\":[[[74,27],[83,27],[83,21],[74,21],[74,27]]],\"spatialReference\":{\"wkid\":4326}}");
var geom2 = Esri.ArcGISRuntime.Geometry.Geometry.FromJson("{\"rings\":[[[78,29],[87,29],[87,22],[78,22],[78,29]]],\"spatialReference\":{\"wkid\":4326}}");
var geom3 = GeometryEngine.Union(geom1, geom2); I also tried to interactively draw the rectangle and perform the union of those. This will create geometries in the same reference as the map. private async void Button_Click(object sender, RoutedEventArgs e)
{
try
{
var geom1 = await MyMapView.SketchEditor.StartAsync(SketchCreationMode.Rectangle, false);
var geom2 = await MyMapView.SketchEditor.StartAsync(SketchCreationMode.Rectangle, false);
var geom3 = GeometryEngine.Union(geom1, geom2);
var graphic = new Graphic(geom3, new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, Colors.Blue, null));
var overlay = MyMapView.GraphicsOverlays[0];
overlay.Graphics.Add(graphic);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
} Can you see if calling GeometryEngine.Simplify to input geometries before calling Union, returns a valid union geometry?
... View more
03-29-2017
02:08 PM
|
0
|
0
|
2193
|
|
POST
|
Hi Kevin, Sorry for the delay. Public items and groups are expected to be returned according to ArcGIS REST API - Portal (see 'access' and 'canSearchPublic'). There may be other security settings you can configure in your portal to get your desired create/search capability, which ArcGIS Portal team or support might answer best. I did some testing with our own portal (disabled anonymous access [access:false], disabled service directory [canSearchPublic:false]) using ArcGIS Runtime SDK for .NET code below. The result I got were as follows. Sharing both code and web request in case you want to plug in your own portal info. AuthenticationManager.Current.ChallengeHandler = new ChallengeHandler(async (info) =>
{
var credential = await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, username, password);
return credential;
}); var portal = await ArcGISPortal.CreateAsync(new Uri(portalUrl));
var privatePortalItem = await PortalItem.CreateAsync(portal, privateItem);
var publicPortalItem = await PortalItem.CreateAsync(portal, publicItem);
var privateFindResult = await portal.FindItemsAsync(new PortalQueryParameters($"id:{privateItem}"));
var publicFindResult = await portal.FindItemsAsync(new PortalQueryParameters($"id:{publicItem}")); Operation Disabled Anonymous Access Web request Create portal No challenge http://<portalurl>/sharing/rest/portals/self?f=json Create private portal item Has challenge, creates item http://<portalurl>/sharing/rest/content/items/<privateitem>?f=json Create public portal item No challenge, creates item http://<portalurl>/sharing/rest/content/items/<publicitem>?f=json Find private portal item No challenge, returns empty http://<portalurl>//sharing/rest/search?q=id%<privateitem>&start=1&num=10&f=json Find public portal item No challenge, returns item http://<portalurl>//sharing/rest/search?q=id%<publicitem>&start=1&num=10&f=json I wish I could help more but this seems to be a question better answered by ArcGIS Portal team since runtime API can only raise a challenge if server responded with authentication error. Apparently, public portal items can be created and searched regardless of disabling anonymous access on portal.
... View more
03-24-2017
03:13 PM
|
0
|
4
|
3323
|
|
POST
|
When you have a portal with anonymous access disabled, to create that portal, be able to search items, and create portal item with it, etc. using ArcGIS Runtime for .NET, you'd have to pass credential parameter. Otherwise, you only get portal info. try
{
var credential = await AuthenticationManager.Current.GenerateCredentialAsync(new Uri("<your portal uri>/sharing/rest"), "<your portal username>", "<your portal password>");
var portal = await ArcGISPortal.CreateAsync(new Uri("<your portal uri>"), credential);
var items = await portal.FindItemsAsync(new PortalQueryParameters("access:private"));
var portalItem = await PortalItem.CreateAsync(portal, "<your portal item id>");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
} When you have a portal with anonymous access enabled, you don't need to pass credential when you create that portal but will only have access to public portal items. If you try to create portal item with private access, you should be prompted with a challenge for your portal username and password. AuthenticationManager.Current.ChallengeHandler = new ChallengeHandler(async (info) =>
{
var credential = await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, "<your portal username>", "<your portal password>");
return credential;
}); How are you creating the portal and getting the portal item? I can't seem to reproduce getting portal items from a portal with disabled anonymous access if I don't provide credential.
... View more
03-21-2017
03:32 PM
|
0
|
1
|
3323
|
| 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 |
03-12-2026
09:38 AM
|