POST
|
Hosted layer views look the same as regular layers to a user. They have an item id and url, so you can use them in the same way you would any other layer.
... View more
06-18-2024
02:22 PM
|
0
|
1
|
262
|
POST
|
You might want to look at building your own custom UI element that covers what you need. You can use the NavigationToggleViewModel to handle the logic and build a custom UI around that. You can do it in your framework of choice or a vanilla HTML/JS element.
... View more
06-11-2024
09:45 AM
|
0
|
1
|
245
|
POST
|
So I had some time and a crazy idea. You could return a Features widget in the CustomContent of your popup and turn your innerGraphics into pseudo graphics the Features widget could use. It requires some set up, but it works. https://codepen.io/odoe/pen/xxNdQMQ?editors=0010 const fieldContent = new FieldsContent({
outFields: ["*"],
fieldInfos: [
{
fieldName: "crashId",
label: "Crash ID"
},
{
fieldName: "groupId",
label: "Group ID"
}
]
});
const customContentWidget = new CustomContent({
outFields: ["*"],
creator: ({ graphic }) => {
const { innerGraphics } = graphic.attributes;
const graphics = innerGraphics.map((attributes) => {
return new Graphic({
geometry: null,
attributes,
popupTemplate: {
title: "Inner Crash ID: {crashId}",
content: [
{
type: "fields",
outFields: ["*"],
fieldInfos: [
{
fieldName: "crashId",
label: "Inner Crash ID"
},
{
fieldName: "groupId",
label: "Inner Group ID"
},
{
fieldName: "symbolType",
label: "Symbol"
},
{
fieldName: "direction",
label: "Direction"
},
{
fieldName: "severity",
label: "Severity"
},
{
fieldName: "narrative",
label: "Narrative"
}
]
}
]
}
});
});
console.log(graphics);
const features = new Features({
features: graphics,
visible: true,
visibleElements: {
actionBar: false,
closeButton: false,
collapseButton: false,
}
});
return features;
}
});
const graphicObj = {
geometry: {
spatialReference: {
wkid: 4326
},
x: -72.93538699999993,
y: 41.332516000000055,
type: "point" // add geometry type
},
symbol: null,
attributes: {
crashId: 1,
symbolType: "Sideswipe, Same Direction",
groupId: 25,
direction: null,
date: null,
innerGraphics: [
{
crashId: 222,
symbolType: "Sideswipe, Same Direction",
groupId: 20,
direction: 0,
date: 1682173620000,
severity: "O",
narrative: ""
},
{
crashId: 333,
symbolType: "Front to Rear",
groupId: 14,
direction: 0,
date: 1674143040000,
severity: "O",
narrative: ""
},
{
crashId: 111,
symbolType: "Front to Rear",
groupId: 22,
direction: 0,
date: 1697535840000,
severity: "O",
narrative: "Narrative unavailable for this crash."
}
]
},
popupTemplate: {
title: "Crash ID: {crashId}",
outFields: ["*"],
content: [fieldContent, customContentWidget]
}
};
view.graphics.add(graphicObj);
... View more
06-04-2024
01:15 PM
|
1
|
0
|
218
|
POST
|
This is going to require using CustomContent and writing your own UI to display that info. The creator event will give you the graphic and you can return some custom HTML in the function to display your results. I had shown something similar here for weather data.
... View more
06-04-2024
08:28 AM
|
2
|
0
|
259
|
POST
|
There is a calcite tutorial on how to do this you can apply to a react application. https://developers.arcgis.com/calcite-design-system/tutorials/build-a-dark-mode-switch/ The main thing to know is this part of the tutorial. const updateDarkMode = () => {
// Calcite mode
document.body.classList.toggle("calcite-mode-dark");
// ArcGIS Maps SDK theme
const dark = document.querySelector("#arcgis-maps-sdk-theme-dark");
const light = document.querySelector("#arcgis-maps-sdk-theme-light");
dark.disabled = !dark.disabled;
light.disabled = !light.disabled;
// ArcGIS Maps SDK basemap
map.basemap = dark.disabled ? "gray-vector" : "dark-gray-vector";
// Toggle ArcGIS Maps SDK widgets mode
const widgets = document.getElementsByClassName("esri-ui");
for (let i = 0; i < widgets.length; i++) {
widgets.item(i).classList.toggle("calcite-mode-dark");
}
};
document.querySelector("calcite-switch").addEventListener("calciteSwitchChange", updateDarkMode);
... View more
05-30-2024
08:50 AM
|
0
|
0
|
301
|
POST
|
You will need to add some authentication to your application. In the documentation there is a section in the table of contents you can refer to. https://developers.arcgis.com/javascript/latest/ The links in that dropdown ArcGIS Org Portals - https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/ Access Secure Resources - https://developers.arcgis.com/javascript/latest/secure-resources/ Tutorial - https://developers.arcgis.com/javascript/latest/tutorials/implement-user-authentication/ Sample - https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/
... View more
05-22-2024
08:56 AM
|
0
|
0
|
303
|
POST
|
You can check the searchTerm property https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#searchTerm It just depends on what event you want to check it https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#events-summary searchWidget.on("suggest-start", () => {
console.log("term: ", searchWidget.searchTerm);
});
searchWidget.on("suggest-complete", () => {
console.log("term: ", searchWidget.searchTerm);
});
... View more
05-20-2024
07:31 AM
|
1
|
1
|
247
|
POST
|
As long as you have Routing and probably geocoding enabled for your key, should be fine.
... View more
05-03-2024
10:21 AM
|
1
|
1
|
458
|
POST
|
The sample works in the sandbox. https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-directions Are you opening the codepen link? If so, the Route service requires an API Key, so you need to provide a key in your own app.
... View more
05-03-2024
09:29 AM
|
1
|
4
|
504
|
POST
|
The map and scene components have a map property that you can reference to add layers. https://developers.arcgis.com/javascript/latest/components/storybook/?path=/docs/map-components_component-reference-map--docs In the "next" version, which will be in 4.30, we added a method on the elements for addLayer and addLayers. async function load() {
const Layer = await $arcgis.import("esri/layers/Layer");
const url =
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2";
const layer = await Layer.fromArcGISServerUrl({
url
});
// Reference the map component
const mapElem = document.querySelector("arcgis-map");
mapElem.addEventListener("arcgisViewReadyChange", () => {
// works today
// mapElem.map.add(layer);
}, { once: true });
// available in next, will be in 4.30
mapElem.addLayer(layer);
}
load(); Here is a codepen. https://codepen.io/odoe/pen/NWowrmo?editors=0010
... View more
05-03-2024
08:26 AM
|
0
|
0
|
215
|
POST
|
By default, mode of Expand is auto, you can set to floating to prevent the drawer from showing on smaller screens. https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Expand.html#mode
... View more
05-02-2024
02:54 PM
|
0
|
1
|
298
|
POST
|
There's also examples on github https://github.com/Esri/jsapi-resources/tree/main/esm-samples/jsapi-react https://github.com/Esri/arcgis-maps-sdk-javascript-samples-beta/tree/main/packages/map-components/templates/react Also a number of videos from previous DevSummits https://mediaspace.esri.com/esearch/search?keyword=react
... View more
05-01-2024
08:46 AM
|
0
|
0
|
213
|
POST
|
Ok, move the script tag with the load code to after the arcgis-map tag and before end of body tag. <!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
<title>Map components AMD template</title>
<link rel="icon" href="data:;base64,=" />
<style>
html,
body {
background-color: var(--calcite-ui-foreground-2);
padding: 0;
margin: 0;
width: 100vw;
height: 100vh;
}
.my-button {
margin: 0;
position: absolute;
left: 100px;
top: 10px;
}
</style>
<script type="module" src="https://js.arcgis.com/calcite-components/2.6.0/calcite.esm.js"></script>
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/2.6.0/calcite.css" />
<link rel="stylesheet" href="https://js.arcgis.com/next/esri/themes/dark/main.css" />
<script src="https://js.arcgis.com/next/"></script>
<script type="module" src="https://jsdev.arcgis.com/map-components/next/arcgis-map-components.esm.js"></script>
</head>
<body>
<arcgis-map id="mapElem" item-id="d5dda743788a4b0688fe48f43ae7beb9">
<arcgis-sketch position="top-right"></arcgis-sketch>
</arcgis-map>
<script>
async function load() {
const sketch = document.querySelector("arcgis-sketch");
sketch.addEventListener("arcgisReady", () => {
console.log("sketch ready");
});
sketch.addEventListener("arcgisCreate", (e) => {
console.log("sketch create", e);
});
sketch.addEventListener("arcgisUpdate", (e) => {
console.log("sketch update", e);
});
}
load();
</script>
</body>
</html> You typically want script tags with JS as the last tag in the body so that it loads after contents of the html body load.
... View more
04-30-2024
09:32 AM
|
1
|
1
|
345
|
POST
|
That error looks like you don't have an arcgis-sketch element on the page. If you provide a repro per the doc, could tell better. https://developers.arcgis.com/javascript/latest/troubleshooting/#minimal-reproducible-application
... View more
04-30-2024
07:29 AM
|
0
|
3
|
359
|
POST
|
This works in "next", but we made some changes to the event names. https://codepen.io/odoe/pen/yLrbBoR?editors=0011 Event names no longer include the name of the component and they are all prefixed with 'arcgis' in the names. We'll get that added to the breaking changes here. https://github.com/Esri/feedback-js-api-next/blob/main/CHANGELOG.md#components-breaking-changes
... View more
04-29-2024
05:20 PM
|
0
|
5
|
380
|
Title | Kudos | Posted |
---|---|---|
1 | a week ago | |
3 | 2 weeks ago | |
1 | 3 weeks ago | |
1 | 3 weeks ago | |
1 | 04-11-2022 10:39 AM |
Online Status |
Online
|
Date Last Visited |
2 hours ago
|