|
POST
|
Ok...in this case, it seems like the client-side is doing what it should and that the problem is likely on the server-side. If you have access to ArcGIS Server Manager, you might check the logs to see if they're showing anything. Otherwise, I suppose the next course of action would be to take it up with technical support.
... View more
01-26-2024
09:31 AM
|
0
|
1
|
2227
|
|
POST
|
I'm guessing that simply supplying the layer's tileInfo as is may not be the format expected. The aforementioned documentation doesn't give the structure of the object, and simply says "For more information on tileInfo, see the ArcGIS REST API." However, it's not clear where to go from there to find structure for the tileInfo. I'm guessing that the output is supposed to be in the format discussed here. In that case, there's a good chance that simply calling the tileInfo object's toJSON method will give you what you need.
... View more
01-25-2024
09:31 AM
|
0
|
3
|
2249
|
|
POST
|
Version 4.26 introduced the ability to specify a background color and border for TextSymbols. See also the release notes...although it speaks specifically of FeatureLayer labels, the changes apply to any use of TextSymbol. I think that's the closest you're going to get with what the SDK natively provides.
... View more
01-24-2024
10:02 AM
|
0
|
0
|
1510
|
|
POST
|
According to the ExportWebMap specification (search for "Syntax for WebTiledLayer"), including tileInfo for a WebTileLayer is optional, and you are correct in that the tileInfo is not included for WebTileLayers by the esri/rest/print module. I figure you have at least 2 options: 1) If you host the SDK locally, you could modify the esri/rest/print module to include the tileInfo. Within that file, the code in question looks like this for 4.28: function sa(a) {
const b = {
type: "WebTiledLayer",
urlTemplate: a.urlTemplate?.replace(/\${/g, "{"),
credits: a.copyright
};
a.subDomains && 0 < a.subDomains.length && (b.subDomains = a.subDomains);
return b
} It would be easy to insert a line between 7 and 8 that includes the tileIInfo. 2) The approach most likely to be recommended would be to use a RequestInterceptor (via esriConfig.request) to intercept the request and add the tileInfo before it gets sent to the server.
... View more
01-24-2024
09:38 AM
|
1
|
5
|
2275
|
|
POST
|
Yes, this can be done with CSS: div.esri-time-slider__animation,
div.esri-time-slider__previous,
div.esri-time-slider__next {
display: none;
}
... View more
01-22-2024
09:23 AM
|
1
|
0
|
1196
|
|
POST
|
Sorry about that, I didn't test it before posting, and it appears that the visible property gets set before the selectedFeature property. It looks like if you reverse things to watch selectedFeature instead, you get the expected reference: reactiveUtils.watch(() => view.popup?.selectedFeature, (selectedFeature) => {
if ((selectedFeature) && (view.popup.visible)) {
console.info(view.popup.selectedFeature.getObjectId());
}
});
... View more
01-19-2024
09:53 AM
|
0
|
0
|
1678
|
|
POST
|
I've found the default Popup positioning tends to be unreliable, but fortunately you can override the default behavior by assigning a function to the alignment property. I've modified the aforementioned sample below with what my apps use. In particular, I added lines 52-80, and also the reference to reactiveUtils on line 35. <html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Intro to popups | Sample | ArcGIS Maps SDK for JavaScript 4.28</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#instruction {
z-index: 99;
position: absolute;
top: 15px;
left: 50%;
padding: 5px;
margin-left: -175px;
height: 30px;
width: 355px;
background: rgba(25, 25, 25, 0.8);
color: white;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.28/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.28/"></script>
<script>
require(["esri/rest/locator", "esri/Map", "esri/views/MapView", "esri/core/reactiveUtils"], (locator, Map, MapView, reactiveUtils) => {
// Set up a locator url using the world geocoding service
const locatorUrl = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer";
// Create the Map
const map = new Map({
basemap: "streets-navigation-vector"
});
// Create the MapView
const view = new MapView({
container: "viewDiv",
map: map,
center: [-71.6899, 43.7598],
zoom: 12
});
reactiveUtils.watch(() => view.popup?.id, function() {
view.popup.alignment = function() {
var location = this.location;
var view = this.view;
if ((location) && (view)) {
var viewPoint = view.toScreen(location);
var y2 = view.height / 2;
var x2 = view.width / 3;
var x3 = x2 * 2;
if (viewPoint.y >= y2) {
if (viewPoint.x < x2)
return "top-right";
else if (viewPoint.x > x3)
return "top-left";
} else {
if (viewPoint.x < x2)
return "bottom-right";
else if (viewPoint.x > x3)
return "bottom-left";
else
return "bottom-center";
}
}
return "top-center";
};
});
/*******************************************************************
* This click event sets generic content on the popup not tied to
* a layer, graphic, or popupTemplate. The location of the point is
* used as input to a reverse geocode method and the resulting
* address is printed to the popup content.
*******************************************************************/
view.popupEnabled = false;
view.on("click", (event) => {
// Get the coordinates of the click on the view
const lat = Math.round(event.mapPoint.latitude * 1000) / 1000;
const lon = Math.round(event.mapPoint.longitude * 1000) / 1000;
view.openPopup({
// Set the popup's title to the coordinates of the location
title: "Reverse geocode: [" + lon + ", " + lat + "]",
location: event.mapPoint // Set the location of the popup to the clicked location
});
const params = {
location: event.mapPoint
};
// Display the popup
// Execute a reverse geocode using the clicked location
locator
.locationToAddress(locatorUrl, params)
.then((response) => {
// If an address is successfully found, show it in the popup's content
view.popup.content = response.address;
})
.catch(() => {
// If the promise fails and no result is found, show a generic message
view.popup.content = "No address was found for this location";
});
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
<div id="instruction" class="esri-widget">Click any location on the map to see its street address</div>
</body>
</html>
... View more
01-18-2024
03:52 PM
|
2
|
1
|
1835
|
|
POST
|
You can get a reference to the popup's currently displayed graphic via the selectedFeature property. reactiveUtils.watch(() => view.popup?.visible, (visible) => {
if ((visible) && (view.popup.selectedFeature)) {
console.info(view.popup.selectedFeature.getObjectId());
}
});
... View more
01-18-2024
09:48 AM
|
1
|
2
|
1729
|
|
POST
|
This is possible, but whether or not it would be considered convenient could go either way. There's two parts to this:1 is drawing the geometry, and 2 is capturing whether the Ctrl key is down or not when it's drawn. For the geometry, I would recommend using the SketchViewModel module. To capture whether the Ctrl key is down or not, you would use the pointer-down and pointer-up events of the MapView. The argument passed to those event handlers will have a property called "native" that provides information about the click. That "native" object has a Boolean property named "ctrlKey" So, when using the SketchView model to draw a rectangle for example, you would capture the state of the ctrlKey property at the beginning and end of the sketch, and respond in your application accordingly if it was true in both cases.
... View more
01-11-2024
03:32 PM
|
0
|
1
|
1272
|
|
BLOG
|
Thank you @JesseCloutier for the kind words. Although my profile also says I joined back in 2014, I evidently haven't been very active for most of that time. Giving credit to where it's due, I believe the uptick in my activity in recent years is due in no small part to the increased participation of the ArcGIS Maps SDK for JavaScript development team during that same time...people like @BjornSvensson, @Noah-Sager, @UndralBatsukh, @KristianEkenes, @ReneRubalcava, @LaurenBoyd, @AnneFitz, @JoseBanuelos, @Sage_Wall, and @AndyGup (my apologies to any I failed to include). These folks are actively engaged in the Esri Community, and are putting to good use what I and others share there to improve their products...not to mention helping us out a great deal as well. In their product's release notes, it's become the norm to see links to Esri Community threads where bugs are reported, workarounds or fixes proposed, and ideas implemented. As a result, I think they've made it a much more welcoming environment to participate in, and I look forward to what 2024 has in store.
... View more
01-10-2024
09:48 AM
|
3
|
0
|
3334
|
|
POST
|
Since a StreamLayer can only support one geometryType, you won't be able to use a point layer to display lines. However, you can mimic this by adding a GraphicsLayer, getting the point data from your StreamLayer, creating a line from those points, and adding it to the GraphicsLayer. The trickiest part of that is getting the point data from the StreamLayer, but even that's not all that bad. To do this, you'll need to get a reference to its associated StreamLayerView. The StreamLayerView has a data-received event that fires when new features are received. It also has a queryFeatures function which you can also use to get the points from your StreamLayer. Between these, you'd have all you need to create and display the track line(s) in the GraphicsLayer.
... View more
01-08-2024
11:47 AM
|
2
|
0
|
1892
|
|
POST
|
I'm not sure what is meant by an extent information error...you may need to give further information on that. Note that the documentation explains why the zoom value can be -1 in the "Zoom and LODs" section of the MapView documentation, and also in the discussion of the zoom property. Perhaps that might help you figure out what's going on as well.
... View more
01-04-2024
08:43 AM
|
1
|
0
|
1292
|
|
POST
|
Since you say goTo works with 3857, this indicates your view.spatialReference is 3857 (Web Mercator). If that's the case, then using goTo with geometries in anything other than 3857 will not work. Therefore, you will need to reproject your point from 3826 to 3857 first. You can do that using the project method of the esri/geometry/projection module.
... View more
01-03-2024
08:28 AM
|
0
|
2
|
1315
|
|
POST
|
Happy 2024...here's some good news to kick off the new year. ESRI has indicated they're updating the underlying framework (the ArcGIS Maps SDK for JavaScript) to display features in layer order in its next release (targeted for February of this year). See also this page, although below is the relevant text for future reference: Feature order in the Popup and Features widget The Popup and Features widgets now display features from multiple layers in the order they are displayed in the map. This means that the features of the topmost layer in the map will appear first, followed by the features of the next layer, and so on. In previous versions, the features were displayed in the order they were returned from the server.
... View more
01-02-2024
11:40 AM
|
2
|
0
|
2625
|
|
POST
|
I don't think there's a documented way to do this. However, if you're willing to venture into the realm of the undocumented, you can easily get the list of the highlighted features' OBJECTID values from the layerView's "_highlightIds" property: var objectIDs = Array.from(layerView._highlightIds.keys()); You can then use the layer's queryFeatures method to get the highlighted features: var query = layer.createQuery();
query.objectIds = objectIDs;
layer.queryFeatures(query).then(function(featureSet) {
//do something
}); Note that using undocumented features carries the risk of those features being modified or removed in a future release without notice.
... View more
12-21-2023
09:55 AM
|
0
|
0
|
1752
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-19-2024 10:37 AM | |
| 1 | 03-31-2026 02:34 PM | |
| 1 | 12-09-2025 09:35 AM | |
| 2 | 12-09-2025 09:06 AM | |
| 1 | 11-26-2025 12:29 PM |