POST
|
OK, I found the following in the samples. It's mostly doing what i thought.... var tolerance = 10d; // Use larger tolerance for touch
var maximumResults = 1; // Only return one graphic
var onlyReturnPopups = false; // Don't return only popups
// Use the following method to identify graphics in a specific graphics overlay
IdentifyGraphicsOverlayResult identifyResults = await TreeMapView.IdentifyGraphicsOverlayAsync(
_workingLayer,
e.Position,
tolerance,
onlyReturnPopups,
maximumResults);
// Check if we got results
if (identifyResults.Graphics.Count > 0)
{
// Make sure that the UI changes are done in the UI thread
Device.BeginInvokeOnMainThread(async () => {
await DisplayAlert("", "Tapped on graphic", "OK");
});
}
... View more
04-25-2017
07:07 PM
|
1
|
0
|
562
|
POST
|
I want to be able to run some code when a graphic or feature is clicked on. On the mapview, I can see a tap handler(OnGeoViewDoubleTapped and OnGeoViewTapped), but it returns the MapView and a point in the event. I can't find in the FeatureTable or the GraphicsOverlay a way to handle a click event...IE run some code when a Feature or Graphic is clicked on. The only solution i can see is to use the GeoViewInputEventArgs e, find the point they clicked on, then do a query to see what they clicked on. Is anyone able to tell me how to properly handle a click event on a feature or graphic?
... View more
04-25-2017
06:39 PM
|
0
|
1
|
1107
|
POST
|
Aye, that's it thanks. Yes, working with a ServiceFeatureTable. All 50 attributes now returning. Not sure how i missed that overload. Cheers! var queryResult = await _featureTable.QueryFeaturesAsync(query,QueryFeatureFields.LoadAll);
... View more
04-25-2017
03:17 PM
|
0
|
0
|
1117
|
POST
|
I am trying to Query a Feature Layer, but only the core ESRI attributes are being returned. How do i get all of the attributes? If i look at the Fields property of the feature layer (_featureLayer below) i am querying, it does list all the custom fields available, but they just aren't returning when i do a query. There isn't a "OutFields" property in the QueryParameters object that I can see... Query code below. var query = new QueryParameters
{
Geometry = TreeMapView.VisibleArea,
SpatialRelationship = SpatialRelationship.Contains,
ReturnGeometry = true,
};
_featureLayer.ClearSelection();
var queryResult = await _featureTable.QueryFeaturesAsync(query);
var features = queryResult.ToList();
foreach (var item in features)
{
//*** EACH item has only 7 attributes, and they are only the ESRI core ones
}
... View more
04-25-2017
02:36 PM
|
0
|
6
|
1651
|
POST
|
I got it working by creating my own Basemap and removing all spatialReference's. Cheers!
... View more
03-02-2017
12:12 PM
|
0
|
0
|
608
|
POST
|
I also just tried setting view to a global variable, and it still doesn't work / no errors in console 😕
... View more
03-02-2017
11:37 AM
|
0
|
0
|
608
|
POST
|
There are no errors in the console. Here is the output after i refresh the page, then click the button:
... View more
03-02-2017
11:27 AM
|
0
|
0
|
608
|
POST
|
I am performing a query on a featurelayer. The query is returning results (I can see results in the console.log), but when i try to view.toGo(returnedFeature) nothing happens. I have tried fixed Point, and a lot of other things, but nothing seems to work. I have set up a button that when you click it, it does the query. I am using the 4.2 API require([
"esri/Map",
"esri/views/SceneView",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/tasks/QueryTask",
"esri/tasks/support/Query",
"esri/geometry/Point",
"dojo/on",
"dojo/domReady!"
],
function (
Map,
SceneView,
MapView,
FeatureLayer,
QueryTask,
Query,
Point,
on
) {
var template = {
title: "{Description}",
content: "<p>Asset ID:<b>{AssetID}</b></p>" +
"<p>Asset Status:<b>{AssetStatus}</b></p>"
};
var url = "http://tga-app-sandbox.tauranga.govt.nz:6080/arcgis/rest/services/TreeApp/TreeCapture_AllMaintainenceAreas/FeatureServer/1";
var featureLayer = new FeatureLayer({
url: url,
outFields: ["*"],
popupTemplate: template
});
var map = new Map({
basemap: "hybrid",
spacialReference: featureLayer.spacialReference
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 16,
center: [176.2, -37.7],
spacialReference: featureLayer.spacialReference
});
on(dojo.query("#default"), "click", function () {
var params = new Query({
returnGeometry: true,
outFields: ["*"]
});
params.where = 'AssetID = 141971';
var qTask = new QueryTask({
url: url
});
qTask.execute(params)
.then(function (response) {
if (!response || !response.features) {
console.log("Asset not found.");
return;
}
console.log(response.features);
view.goTo(response.features[0], { zoom: 18 });
//view.goTo({
// target: new Point({
// x: response.features[0].geometry.x,
// y: response.features[0].geometry.y,
// spatialReference: response.features[0].geometry.spatialReference
// }), zoom: 18
//});
})
.otherwise(function (err) {
console.log(err);
});
});
map.add(featureLayer);
view.then(function () {
var params = new Query({
returnGeometry: true,
outFields: ["*"]
});
params.where = 'AssetID = 115576';
var qTask = new QueryTask({
url: url
});
qTask.execute(params)
.then(function (response) {
if (!response || !response.features) {
console.log("Asset not found.");
return;
}
console.log(response.features);
view.goTo(response.features, {zoom: 5});
})
.otherwise(function (err) {
console.log(err);
});
}, function(error){
console.log( error);
});
}); What am i doing wrong? Neither of my view.goTo functions work?!
... View more
03-02-2017
11:14 AM
|
0
|
5
|
1431
|
POST
|
This made me /sad to learn that PCL's aren't supported. I found this out the hard way today. The whole point of Xamarin forms is to have one code base delivered to multiple platforms. But by limiting us to Shared libraries (instead of portable libraries), we can't even add a service reference or a nuget package to the shared library...thus totally limiting us to what we can do. PCL is the way of the future Xamarin / Crosss platform applications. totally frustrating.
... View more
03-01-2017
12:15 PM
|
1
|
0
|
1289
|
POST
|
I think i figured it out.... in var table = new ServiceFeatureTable { ServiceUri = url, OutFields = new OutFields(OutFields.All) }; I am setting out fields to all. If i instead only ask for a couple selected out fields, then the unselected (ones not included in the outfields list) fields will use their default value, if there is one. SO: var table = new ServiceFeatureTable { ServiceUri = url, OutFields = new OutFields(attributes.Select(x=>x.Key)), }; will use default values when inserting / creating if it's not included in the list of attributes above.
... View more
11-09-2016
12:07 PM
|
0
|
0
|
267
|
POST
|
I am trying to figure out how to use a field's default value when using the .net c# SDK when adding a feature. In ArcGIS, in the Feature Class properties, each field can have a default value: However, I can't seem to find the Default Value via the SDK. Here is my code: var table = new ServiceFeatureTable { ServiceUri = url, OutFields = new OutFields(OutFields.All) }; await GenerateToken(url).ConfigureAwait(false); await table.InitializeAsync(table.SpatialReference).ConfigureAwait(false); var schemaFields = table.Schema.Fields.ToList(); var feature = new GeodatabaseFeature(table.Schema) { Geometry = geometry }; foreach (var attribute in attributes) { var field = schemaFields.FirstOrDefault(x => x.Name.ToLower().Equals(attribute.Key.ToLower())); if (field != null) { feature.Attributes[attribute.Key] = attribute.Value != null ? TranslateField(field, attribute.Value) : null; } } await table.AddAsync(feature); var result = await table.ApplyEditsAsync(true); nowhere in the schema field or the feature class is there an option to apply a default value.
... View more
11-09-2016
10:50 AM
|
0
|
1
|
604
|
POST
|
I am using the .net SDK. The queries are actually being performed by a service bus, so there is no "user" viewing a map, only code to query a FeatureLayer. What I am trying to do is take a geometry point from a particular FeatureLayer ( a single point), then Query another FeatureLayer that uses Polygons, and find all the polygons that overlap that particular geometry point. I have found plenty of places to do the opposite (see if a point is within a ploygon), but what i need is to find all polygons that touch a point. The code I am using: var treeFeatureUrl = "<myurl for a feature layer with single points>"; var uri = new Uri(treeFeatureUrl); var queryTask = new QueryTask(uri); var queryParams = new Query("OBJECTID,AssetId") { OutFields = OutFields.All, ReturnGeometry = true, Where = $"AssetID=140156" }; var queryResult = await queryTask.ExecuteAsync(queryParams); var firstTree = queryResult.FeatureSet.Features.FirstOrDefault(); textBox1.Text += JsonConvert.SerializeObject(firstTree, Formatting.Indented) + Environment.NewLine; textBox1.Text += Environment.NewLine + Environment.NewLine; var url = "<myurl for a feature layer with polygon areas>"; var mapUri = new Uri(url); var qTask = new QueryTask(mapUri); var qparams = new Query("OBJECTID") { Geometry = firstTree.Geometry, OutFields = OutFields.All, ReturnGeometry = false, SpatialRelationship = SpatialRelationship.Within, }; var findREsult = await qTask.ExecuteAsync(qparams); var foundFeatures = findREsult.FeatureSet.Features; textBox1.Text += JsonConvert.SerializeObject(foundFeatures, Formatting.Indented) + Environment.NewLine; textBox1.Text += Environment.NewLine + Environment.NewLine; The above code never returns any results, probably because it's using the geometry from the firstTree as the search area. I am not sure how to accomplish what it is I am trying to achieve: find all polygons that touch a certain single point.
... View more
04-13-2016
03:42 PM
|
0
|
1
|
2237
|
POST
|
If you install the ArcObjects SDK ArcObjects_SDK_for_NET_Framework_1031_145767.exe (or later?) it comes with a project that you can add to a solution in Visual Studio. It auto creates the SOI class you need to intercept with. It also creates the .SOE file on build, and places it in the bin folder to import into ArcGIS Server.
... View more
11-26-2015
01:15 PM
|
0
|
0
|
722
|
Title | Kudos | Posted |
---|---|---|
1 | 04-25-2017 07:07 PM | |
1 | 03-01-2017 12:15 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|