|
POST
|
Thank you so much for the reproducible case. It was really easy to set it up with our test service. So I was able to reproduce the problem you described. As you have described, api queries are not honoring the FeatureLayer.historicMoment after its initial settings. Subsequent queries are being made with the initial historic moment. I have created an issue for this and do not have a workaround for this. I will be sure to update you once we fix the issue. Thank you so much for bringing this issue to our attention. -Undral
... View more
04-27-2021
04:47 PM
|
0
|
1
|
10028
|
|
POST
|
Hi there, Is it possible for you post how and when you are setting your historicMoment parameters? Basically I am looking for a code snippet where I can reproduce the behavior you are running into so that we can fix the issue. I just ran a very simple test and seems like historic moments are being honored. In this example, I am starting with a specified historic moment and is working. var featureLayer = new FeatureLayer({
url: "serviceUrl",
outFields: ["*"],
gdbVersion: "yourVersion",
historicMoment: new Date(1619458348280)
});
featureLayer.on("edits", function(result){
console.log("edit result", result);
var query = featureLayer.createQuery();
console.log("query", query.historicMoment, featureLayer.historicMoment);
featureLayer.queryFeatureCount().then(function(results){
console.log("query", results)
});
}); Thanks, -Undral
... View more
04-26-2021
11:03 AM
|
0
|
3
|
10051
|
|
POST
|
Hi there, What Jose said is correct. The reason you are not able to zoom into selected features and full extent is because the feature layer has a different spatial reference than the view's spatial reference. To solve this issue a few things need to be done in your app. In order to zoom to the selected features, please set the query.outSpatialReference to match the spatialReference of the view so that the returned results can be located on the map. See below: query.objectIds = featureIds;
query.returnGeometry = true;
query.outSpatialReference = view.spatialReference; As for the fullExtent of the FeatureLayer, I'd suggest that you pass in a predefined extent that matches the view's spatialReference. If that is not an option then you can use the projection module's project method to project the fullExtent of your layer to match the spatialReference of the view. But loading projection module for this case only maybe an overkill. projection.load().then(function () {
projectedFullExtent = projection.project(
featureLayer.fullExtent,
view.spatialReference
);
}); Forgot to mention this initially... You have to reproject the fullExtent of your layer to match the spatial reference of the view because View.goTo does not project the geometries on the fly. We have an enhancement request for this. But for now, you have to project your geometry to match the spatial reference of the view before calling goTo. Here is an updated simple test app that shows how to zoom to fullExtent and selected features. Hope this helps, -Undral
... View more
04-23-2021
02:52 PM
|
0
|
0
|
2582
|
|
POST
|
Hi there, Would you be able to share your service with me so that we can investigate the issue? Thanks, -Undral
... View more
04-23-2021
11:07 AM
|
0
|
1
|
1290
|
|
POST
|
Hi there, You do not need to set up the watchUtils whenever you click or use mouse wheel on the viewDiv. You can set your logic to watch the zoom property as soon as the view is initialized and you set this only once. The following logic will be very chatty. Your onZoomChange will trigger many times until the view is zoomed into its final level. context.esriModules.watchUtils.watch(context.view, "zoom", onZoomChange); If you want to run the code when the view is done zooming then you can do the following. Instead of watching view's zoom property, watch the view's updating property. The view.updating will become true while user is zooming in or out. Then its value will change to false once the zoom ends. Now you can get the view's new zoom level and run your logic. const view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65] // longitude, latitude
});
// Watch view's updating event
watchUtils.watch(view, "updating", onZoomChange);
function onZoomChange(newValue, oldValue, propertyName, target) {
if (!view.updating){
// View just finished updating. Get the new zoom value from the view
console.log("view.stationary", view.stationary, "view.updating", view.updating, view.zoom)
}
} Hope this helps, -Undral
... View more
04-23-2021
08:55 AM
|
0
|
0
|
4601
|
|
POST
|
Hi there, It should work. Perhaps you are adding one of layer types that is not supported in the Legend widget? You can see the list of unsupported layers from the sdk doc. If it is not working, could you please provide a test app? Looks like you probably already know about this sample: https://developers.arcgis.com/javascript/latest/sample-code/widgets-layerlist-actions/ I have updated this sample to use legend and did not see any issues: https://codepen.io/U_B_U/pen/mdRQpwM?editors=1000 -Undral
... View more
04-21-2021
03:51 PM
|
1
|
1
|
3044
|
|
POST
|
Hi there, Thanks for reporting this issue. We have created an issue for this and I will be sure to update you once we address it. In meantime, you can replace degree character/° to * as shown below: This should work. `55*56'39"N 3*09'43"W` -Undral
... View more
04-21-2021
11:45 AM
|
0
|
0
|
5811
|
|
POST
|
HI there, This cannot be done at this time. We have an issue to add those missing parameters to 4.x IdentifyParameter class. We care also working on for the popup to show information only for visible features. I will update you once those issues are installed. -Undral
... View more
04-20-2021
01:28 PM
|
0
|
1
|
1594
|
|
POST
|
Hi there, The test app I provided already does that. When you query your features to edit, you set the query parameter's returnGeometry to false as shown below: const query = {
geometry: geometry,
outFields: ["*"],
returnGeometry: false
}; Check out the test app. I added the console.log to show that feature's geometry is null. If you have other questions please create a new question since the original question is addressed. Thanks, -uNDral
... View more
04-19-2021
12:07 PM
|
1
|
0
|
3370
|
|
POST
|
Hi there, You can use client-side FeatureLayer to achieve what you are asking. This sample shows you how to create a client-side feature layer and add/remove features from it at runtime with the use of FeatureLayer.applyEdits. In any case, this is the workflow you can have. 1. Initialize an empty feature collection as shown below: const layer = new FeatureLayer({
fields: [
{
name: "ObjectID",
alias: "ObjectID",
type: "oid"
},
{
name: "Name",
alias: "Name",
type: "string"
},
{
name: "Type",
alias: "Type",
type: "string"
}
],
objectIdField: "ObjectID",
geometryType: "point", // =>>> MATCH THE GEOMETRY TYPE
spatialReference: { wkid: 4326 },
source: [], // adding an empty feature collection
renderer: { // =>>> MATCH THE RENDERER TYPE
type: "simple",
symbol: {
type: "web-style", // =>>> MATCH THE SYMBOL TYPE
styleName: "Esri2DPointSymbolsStyle",
name: "landmark"
}
},
popupTemplate: {
title: "{Name}"
}
}); 2. Then once you have the resultFeatures, use FeatureLayer.applyEdits to add the features. const addEdits = {
addFeatures: graphics
};
layer.applyEdits(addEdits).then(function(results) {
// feature are added... Now you can query the features
})
.catch(function(error){
// apply edits error
}); Hope this helps, -Undrral
... View more
04-19-2021
09:06 AM
|
1
|
0
|
3878
|
|
POST
|
Hi there, You can just set the selectionEnabled property of the LayerList to true. -Undral
... View more
04-19-2021
08:51 AM
|
1
|
0
|
2048
|
|
POST
|
Glad it is working. Can you set this question as resolved? Thanks, -Undral
... View more
04-16-2021
12:53 PM
|
0
|
0
|
6156
|
|
POST
|
Have you copied the entire code? It is working for me in TS. To get around that issue I added the following: routeTask.solve(routeParams).then((data: any) => { Not sure how much more I can help.
... View more
04-16-2021
12:41 PM
|
0
|
1
|
2348
|
|
POST
|
OK the following should work. import SizeSliderViewModel = require("esri/widgets/smartMapping/SizeSlider/SizeSliderViewModel");
import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol");
import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol");
import FeatureSet = require("esri/tasks/support/FeatureSet");
import Graphic = require("esri/Graphic");
import GraphicsLayer = require("esri/layers/GraphicsLayer");
import Map = require("esri/Map");
import MapView = require("esri/views/MapView");
import RouteParameters = require("esri/tasks/support/RouteParameters");
import RouteTask = require("esri/tasks/RouteTask");
// Point the URL to a valid route service that uses an
// ArcGIS Online hosted service proxy
var routeTask = new RouteTask({
url:
"https://utility.arcgis.com/usrsvcs/appservices/srsKxBIxJZB0pTZ0/rest/services/World/Route/NAServer/Route_World"
});
// The stops and route result will be stored in this layer
var routeLayer = new GraphicsLayer();
// // Setup the route parameters
var routeParams = new RouteParameters({
stops: new FeatureSet(),
outSpatialReference: {
// autocasts as new SpatialReference()
wkid: 3857
},
returnDirections: true
});
// Define the symbology used to display the stops
var stopSymbol = new SimpleMarkerSymbol({
style: "cross",
size: 15,
outline: {
// autocasts as new SimpleLineSymbol()
width: 4
}
});
var map = new Map({
basemap: "streets-navigation-vector",
layers: [routeLayer] // Add the route layer to the map
});
var view = new MapView({
container: "viewDiv", // Reference to the scene div created in step 5
map: map, // Reference to the map object created before the scene
center: [-117.195, 34.057],
zoom: 13
});
// Adds a graphic when the user clicks the map. If 2 or more points exist, route is solved.
view.on("click", addStop);
function addStop(event) {
// Add a point at the location of the map click
var stop = new Graphic({
geometry: event.mapPoint,
symbol: stopSymbol
});
view.graphics.add(stop);
// // Execute the route task if 2 or more stops are input
const stops = routeParams.stops as __esri.FeatureSet;
stops.features.push(stop);
if (stops.features.length >= 2) {
routeTask.solve(routeParams).then(getRoute);
}
}
const getRoute = () => {
routeTask.solve(routeParams).then((data: any) => {
console.log(data);
data.routeResults.forEach((result) => {
result.route.symbol = new SimpleLineSymbol({
// type: "simple-line",
color: [5, 150, 255],
width: 3
});
view.graphics.add(result.route);
console.log("result", result);
if (result.directions) {
const directions = document.createElement("ol");
directions.classList.add("esri-widget", "esri-widget--panel", "esri-directions__scroller");
directions.style.marginTop = "0";
directions.style.padding = "15px 15px 15px 30px";
const features = result.directions.features;
console.log("features", features);
features.forEach((result: { attributes: { text: string; length: number } }, i: any) => {
const direction = document.createElement("li");
direction.innerHTML =
result.attributes.text + " (" + result.attributes.length.toFixed(2) + " miles)";
directions.appendChild(direction);
});
view.ui.empty("top-right");
view.ui.add(directions, "top-right");
}
});
});
};
... View more
04-16-2021
11:38 AM
|
0
|
1
|
2354
|
|
POST
|
Hi there, I talked to one our devs for feature services. He suggested that you keep the count no more than 1000 at a time to ensure successful applyEdits operation.
... View more
04-15-2021
04:09 PM
|
0
|
1
|
3403
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-17-2025 03:29 PM | |
| 1 | 07-09-2025 08:48 AM | |
| 2 | 07-08-2025 08:09 AM | |
| 2 | 07-07-2025 03:57 PM | |
| 1 | 06-11-2025 03:25 PM |
| Online Status |
Offline
|
| Date Last Visited |
12-01-2025
08:03 AM
|