|
POST
|
The backslash in a JavaScript string is an escape character that is combined with the character immediately following it to represent a special character, for example \n is a newline character, and \t is a tab character. The parser sees the backslashes in your value, but \c isn't a valid character. To get around this, you need to escape your backslashes so that the compiler interprets them properly. For instance "assets\config\config.json" should instead be "assets\\config\\config.json". You can do this with something like: var urlParams = new URLSearchParams(window.location.search);
var configPath = urlParams.get("config").replace(/\\/g, "\\\\");
... View more
12-01-2023
03:17 PM
|
0
|
0
|
7108
|
|
POST
|
I don't have any I can provide, but you can find some here.
... View more
11-29-2023
09:00 AM
|
0
|
0
|
2175
|
|
POST
|
Attached is that simplistic test I mentioned earlier. It has to be run over https (i.e. from a web server and not from a local machine via file: protocol). Maybe it'll help somehow.
... View more
11-28-2023
03:40 PM
|
0
|
1
|
3904
|
|
POST
|
Yes, but that is a much more complicated problem. You will probably want to start by reviewing this document: Introduction to routing
... View more
11-28-2023
10:03 AM
|
0
|
2
|
2191
|
|
POST
|
It is because on line 73. ext1 and ext3 do not intersect numerically speaking. That is, before the call to union, here is the state of things: ext1: (150, 50) -> (210, 80) ext3: (-175, 55) -> (-120, 65) As you can see, if you put this on a simple cartesian plane, they won't intersect. You can add some functionality to adjust the geometries one rotation around the world to the east or west to get what you're looking for like so: <html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<title>
Intro to graphics | Sample | ArcGIS Maps SDK for JavaScript 4.28
</title>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.28/esri/themes/light/main.css"
/>
<script src="https://js.arcgis.com/4.28/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/Graphic",
"esri/geometry/Polygon",
"esri/geometry/Extent",
"esri/geometry/geometryEngine"
], (Map, MapView, Graphic, Polygon, Extent, GeometryEngine) => {
const map = new Map({
basemap: "hybrid"
});
const view = new MapView({
center: [-180, 60],
container: "viewDiv",
map: map,
zoom: 3
});
var ext1 = new Extent({
xmin: 170.0,
ymin: 56.0,
xmax: -170.0 + 360,
ymax: 70.0
});
drawAThing(ext1);
//-----------------
var ext2 = new Extent({
xmin: 150.0,
ymin: 50.0,
xmax: -150.0 + 360,
ymax: 80.0
});
drawAThing(ext2);
var ext3 = new Extent({
xmin: -175.0,
ymin: 55.0,
xmax: -120.0,
ymax: 65.0
});
drawAThing(ext3);
var ext4 = new Extent({
xmin: 140.0,
ymin: 54.0,
xmax: 175,
ymax: 57.0
});
drawAThing(ext4);
view.on("click", function (evt) {
//-------------------
alert("union ready ?");
view.graphics.removeAll();
var geom = unionGeometries(ext1, ext2);
geom = unionGeometries(geom, ext3);
geom = unionGeometries(geom, ext4);
drawAThing(geom);
//-------------------
});
function drawAThing(geo) {
// Create a symbol for rendering the graphic
var fillSymbol = {
type: "simple-fill", // autocasts as new SimpleFillSymbol()
color: [227, 139, 79, 0.8],
outline: {
// autocasts as new SimpleLineSymbol()
color: [255, 255, 255],
width: 1
}
};
// Add the geometry and symbol to a new graphic
var graphic = new Graphic({
geometry: geo,
symbol: fillSymbol
});
view.graphics.addMany([graphic]);
}
function unionGeometries(geometry, extent) {
if (!extent.intersects(geometry)) {
var extent2 = extent.clone();
extent2.xmax += 360;
extent2.xmin += 360;
if (extent2.intersects(geometry))
return GeometryEngine.union([geometry, extent2]);
else {
extent2.xmin -= 720;
extent2.xmax -= 720;
if (extent2.intersects(geometry))
return GeometryEngine.union([geometry, extent2]);
}
}
return GeometryEngine.union([geometry, extent]);
}
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html> Basically, the unionGeometries function was added, and the "extN" objects were created as full-on Extent objects to make this work. Note this only works if geometries are offset by no more than one rotation.
... View more
11-27-2023
12:09 PM
|
0
|
0
|
1339
|
|
POST
|
I see...there are some extra layers of complexity added by Node and React that I'm not sure how to help you navigate. If you don't find a way to get this working, @Justin_Greco provided another viable solution.
... View more
11-27-2023
09:26 AM
|
0
|
3
|
3421
|
|
POST
|
According to the documentation, this is how you get the distance between two points in WGS 84: const polyline = new Polyline();
polyline.addPath([centerGeom, point]);
const distance = geometryEngine.geodesicLength(polyline, "kilometers");
... View more
11-27-2023
09:13 AM
|
0
|
4
|
2207
|
|
POST
|
This appears to work: View.ui.remove(coordinate_conversion_widget);
coordinate_conversion_widget.mode = "live";
... View more
11-22-2023
04:47 PM
|
0
|
0
|
1277
|
|
POST
|
The workflow described in the third paragraph of this post stopped working again in 4.28, although this time instead of a feature being created, nothing happens. It appears to the be same underlying issue described in this thread, which I didn't come to until troubleshooting the issue on my own. If it helps any, below is what I found. It appears the culprit is in the "handleInputEvent" function of the esri/views/interactive/ToolViewManagerManipulatorState module. In particular, the last line of the case for "immediate-click" is: l?.consumesClicks && a.stopPropagation(); Maybe it should be something like: l?.consumesClicks && a.button !== 2 && a.stopPropagation();
... View more
11-22-2023
02:31 PM
|
0
|
0
|
6064
|
|
POST
|
This is a new bug in 4.28. The tooltip and its contents are not document elements, but are instead graphics rendered on a canvas element, so they're not controllable via CSS. The only workaround I have is to alter my locally hosted copy of the SDK. The problem appears to occur in the "_updateTextColor" method of the undocumented esri/chunks/Tooltip module. I'm not sure if the problem is because the function is called when it shouldn't be, or because something in the function isn't working as intended. Either way, the function overrides the theme's font color with another color that doesn't stand out very well. It happens with the light theme too, which my apps use. The construction of the Tooltip instance takes place in the esri/widgets/ElevationProfile/support/chartUtils module. It looks something like this: const b = Q.Tooltip.new(c.root, {
forceHidden: !0,
getFillFromSprite: !1,
getLabelFillFromSprite: !1,
pointerOrientation: "vertical",
visible: !1
}); I've modified my local copy to include a property called "autoTextColor" with its value set to false like so: const b = Q.Tooltip.new(c.root, {
autoTextColor: !1,
forceHidden: !0,
getFillFromSprite: !1,
getLabelFillFromSprite: !1,
pointerOrientation: "vertical",
visible: !1
}); This prevents the aforementioned "_updateTextColor" function from altering the label's color. I don't know of any better way to make this work, since there doesn't appear to be a way to get a reference to the Tooltip from the ElevationProfile widget. @Noah-Sager perhaps you can add this one to the list...Happy Thanksgiving btw.
... View more
11-22-2023
01:06 PM
|
1
|
0
|
5397
|
|
POST
|
Perhaps you will get better results if you construct a Polyline from the two points, and then use geometryEngine.geodesicLength.
... View more
11-22-2023
10:06 AM
|
0
|
6
|
2240
|
|
POST
|
I found adding a bit of asynchronous delay seems to do the trick: editorVM.watch(['state', 'featureFormViewModel.feature', 'featureFormViewModel.state'], () => {
if (editorVM.state == 'creating-features' && editorVM.featureFormViewModel.feature && editorVM.featureFormViewModel.state == 'ready') {
window.setTimeout(function() {
editorVM.featureFormViewModel.setValue('PhoneNumber', "999.999.999")
}, 200);
}
}); You'll want to be careful this workflow doesn't inadvertently overwrite something the user manually enters; I didn't test for that kind of thing.
... View more
11-22-2023
10:00 AM
|
1
|
0
|
970
|
|
POST
|
Ok, so the problem here is that the response of the query is in a binary (pbf) format, not JSON. There are a couple ways to deal with this, and I would recommend starting with the easiest, which is to force the queries to use JSON format, and not pbf. To do that, add the following somewhere before the SDK is loaded: <script type="text/javascript">
window.dojoConfig = {
has: {
"featurelayer-pbf": false
}
};
</script> If you already have a dojoConfig object, you can consolidate the above with that.
... View more
11-21-2023
09:23 AM
|
2
|
0
|
1665
|
|
POST
|
Hmm...it worked well in a simplistic example I set up locally. Does it cause any error information to be written to the developer tools console when you try it?
... View more
11-20-2023
01:00 PM
|
0
|
5
|
3500
|
|
POST
|
This same issue was reported here about a year and a half ago, where it doesn't seem to have gotten any traction...
... View more
11-20-2023
09:38 AM
|
2
|
1
|
2515
|
| 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 |