|
POST
|
The logs report this: "Error executing tool. ReportCacheStatus : ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds. ArcGIS Server requires a service type (ParentType) and a server object extension type (Type). Failed to execute (ReportCacheStatus)." - System/ReportingTools.GPServer I will see if i can track down this error. Seems odd it works on a single record. Console reports it is happening at this line: featureLayer.applyEdits({updateFeatures:featureSet.features}).then( next line it fails is: featureLayer.queryFeatures().then(function(featureSet) { then: return new Promise(function(resolve, reject) { and lastly: _applyUpdates(roomsTable, batchEditRoom, objectIds).then (function ()
... View more
03-07-2025
01:28 PM
|
0
|
0
|
855
|
|
POST
|
I got thgis to work using a thread here: https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ctrl-mouse-click/td-p/425312 <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Select by Point</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.30/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.30/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/views/draw/Draw",
"esri/Map",
"esri/Graphic",
"esri/layers/GraphicsLayer",
"esri/layers/FeatureLayer",
"esri/geometry/Point",
"esri/geometry/Multipoint",
"esri/views/MapView"
], function (Draw, Map, Graphic, GraphicsLayer, FeatureLayer, Point, Multipoint, MapView) {
const pntGraphics = new GraphicsLayer();
let viewClickEvtHandler = null, viewMouseMoveEvtHandler = null;
var renderer = {
type: "simple", // autocasts as new SimpleRenderer()
symbol: {
type: "simple-fill", // autocasts as new SimpleFillSymbol()
color: [255, 255, 255, 0.5],
style: "none",
outline: { // autocasts as new SimpleLineSymbol()
color: "black",
width: 2
}
}
};
const statesLyr = new FeatureLayer({
url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2',
// renderer: renderer,
outFields: ['*']
});
let drawPnt, graphic, ctrlKey = false, highlight, statesLyrView;
const map = new Map({
basemap: "topo-vector",
layers: [pntGraphics, statesLyr]
});
const view = new MapView({
container: "viewDiv",
map: map,
center: [-105.570, 41.313193],
zoom: 15.5
});
statesLyr.when(function () {
view.whenLayerView(statesLyr).then(function (layerView) {
statesLyrView = layerView;
});
})
const draw = new Draw({
view: view
});
var sym = {
type: "simple-marker",
style: "circle",
color: [0, 255, 255, 0.6],
size: "8px",
outline: {
color: [0, 255, 255, 1],
width: 1
}
};
view.ui.add("point-button", "top-left");
document.getElementById("point-button").onclick = drawPoint;
function drawPoint() {
if (viewMouseMoveEvtHandler) {
viewMouseMoveEvtHandler.remove()
viewMouseMoveEvtHandler = null
}
if (viewClickEvtHandler) {
viewClickEvtHandler.remove()
viewClickEvtHandler = null
}
const action = draw.create("point");
viewMouseMoveEvtHandler = view.on('pointer-move', (evt) => {
if (evt.native.ctrlKey) {
moveCtrlKey = true;
} else {
moveCtrlKey = false;
}
})
viewClickEvtHandler = view.on('pointer-down', (evt) => {
if (evt.native.ctrlKey) {
ctrlKey = true;
} else {
ctrlKey = false;
}
})
if (highlight) {
highlight.remove();
}
// Give a visual feedback to users as they move the pointer over the view
action.on("cursor-update", function (evt) {
view.graphics.removeAll();
drawPnt = new Point({
x: evt.coordinates[0],
y: evt.coordinates[1],
spatialReference: view.spatialReference
});
graphic = new Graphic({
geometry: drawPnt,
symbol: sym
});
view.graphics.add(graphic);
if (ctrlKey && !moveCtrlKey) {
draw.reset();
view.graphics.removeAll();
selectStates();
}
});
action.on("draw-complete", function (evt) {
drawPnt = new Point({
x: evt.coordinates[0],
y: evt.coordinates[1],
spatialReference: view.spatialReference
});
graphic = new Graphic({
geometry: drawPnt,
symbol: sym
});
pntGraphics.add(graphic);
if (ctrlKey) {
drawPoint();
} else {
view.graphics.removeAll();
selectStates();
}
});
view.focus();
};
function selectStates() {
ctrlKey = false
moveCtrlKey = false
if (viewMouseMoveEvtHandler) {
viewMouseMoveEvtHandler.remove()
viewMouseMoveEvtHandler = null
}
if (viewClickEvtHandler) {
viewClickEvtHandler.remove()
viewClickEvtHandler = null
}
let mp = new Multipoint({
spatialReference: view.spatialReference
});
let pntArray = pntGraphics.graphics.map(function (gra) {
mp.addPoint(gra.geometry);
});
const query = {
geometry: mp,
outFields: ["*"],
outSpatialReference: view.spatialReference,
returnGeometry: true
};
statesLyr.queryFeatures(query)
.then(function (results) {
const graphics = results.features;
var employeeEditData = [
{ name: "", id: "" },
{ name: "", id: "" }
];
employeeEditData = [];
for (var i = 0; i < results.features.length; i++) {
if (results.features[i].attributes.BUILDINGID) {
employeeEditData.push({
name: results.features[i].attributes.BUILDINGID,
id: results.features[i].attributes.OBJECTID,
OBJECTID: results.features[i].attributes.OBJECTID,
LONGNAME: results.features[i].attributes.LONGNAME,
});
console.log(results.features[i].attributes.OBJECTID)
}
}
var floorRoomAvailable = [];
for (var k = 0; k < employeeEditData.length; k++) {
// console.log (myRoomAvailableData[k].OBJECTID)
floorRoomAvailable.push(
employeeEditData[k].OBJECTID
);
}
console.log(floorRoomAvailable)
console.log(employeeEditData)
console.log(graphics)
// remove existing highlighted features
if (highlight) {
highlight.remove();
}
// highlight query results
highlight = statesLyrView.highlight(graphics);
console.log("Test")
pntGraphics.removeAll();
}).catch(function (err) {
console.error(err);
})
}
});
</script>
</head>
<body>
<div id="viewDiv">
<div id="point-button" class="esri-widget esri-widget--button esri-interactive" title="Select Countries">
<span class="esri-icon-map-pin"></span>
</div>
</div>
</body>
</html>
... View more
02-11-2025
05:32 AM
|
0
|
0
|
396
|
|
POST
|
I would like to be able to select multiple polygons from a service feature layer using JavaScript. I see this example but have not been able to get it to work with JS 4.30: https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/select-multiple-features-by-mouse-clicks/td-p/588560
... View more
02-07-2025
10:54 AM
|
0
|
1
|
443
|
|
POST
|
I am also getting errors using a later version of JS.
... View more
02-07-2025
10:17 AM
|
0
|
0
|
1555
|
|
POST
|
I am still using JavaScript 3.x for one of our internal web mapping applications. Is there a way to make the legend update when zooming in? It works when the map is printed see attachments. How do i get ot to just show the symbolgy that you see when zoomed in and not all of the symbology in the legend?
... View more
05-14-2024
10:22 AM
|
0
|
0
|
800
|
|
POST
|
Rob, How is it that the Print fucntion will show the legend that refelcts the data that is zoomed in? But, the actual legend does not update the same way?
... View more
05-13-2024
04:46 PM
|
0
|
0
|
797
|
|
POST
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<link rel="shortcut icon" href="//uwoperations.uwyo.edu/uwopsmaps/Documents/Icons/favicon.ico" />
<title>Query Attachments Buildings</title>
<style>
html,
body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
#attachmentsDiv {
height: 100%;
width: 30%;
float: left;
padding: 20px;
overflow: auto;
min-width: 240px;
}
#viewDiv {
height: 100%;
max-width: 70%;
}
.queryImg {
width: 175px;
padding-right: 5px;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.29/esri/themes/dark/main.css" />
<link rel="stylesheet" href="css/allStyles.css">
<script src="https://js.arcgis.com/4.29/"></script>
<!-- <script src="js/map.js"></script>
<script src="js/baseQueries.js"></script>-->
<script>
require ([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/widgets/Legend",
"esri/PopupTemplate",
"esri/popup/content/AttachmentsContent",
"esri/popup/content/support/ImageMediaInfoValue",
"esri/popup/content/ImageMediaInfo",
"esri/popup/content/MediaContent"
], function (
Map, MapView, FeatureLayer, Legend, PopupTemplate, AttachmentsContent, ImageMediaInfoValue, ImageMediaInfo, MediaContent
)
{
function showAtts (event)
{
view.hitTest (event).then (function getGraphics (response)
{
if (response.results.length) {
graphic = response.results[0].graphic;
console.log (graphic);
lyrUrl = graphic.layer.url + "/0/";
objID = graphic.getAttribute ('RemarkPoint.OBJECTID');
attID = graphic.getAttribute ('RemarkPoint__ATTACH.ATTACHMENTID');
imgUrlPath = lyrUrl + objID + "/attachments/" + attID;
let imageMediaInfoValue = new ImageMediaInfoValue ({
sourceURL: imgUrlPath
});
let imageElement = new ImageMediaInfo ({
title: "{LONGNAME}",
caption: "Photo",
value: imageMediaInfoValue
});
let mediaElement = new MediaContent ({
mediaInfos: [imageElement]
});
let template = new PopupTemplate ({
title: "{LONGNAME}",
outFields: ["*"],
showAttachments: true,
content: [mediaElement]
});
layer.popupTemplate = template;
}
});
}
// get layer from online portal
const layer = new FeatureLayer ({
url:
"https://uwoperations.uwyo.edu/hostgis/rest/services/CampusMap/CampusMap_Buildings/FeatureServer/0",
//popupTemplate: template,
outFields: ["*"]
});
// setup the map
const map = new Map ({
basemap: "topo-vector",
layers: [layer]
});
const view = new MapView ({
container: "viewDiv",
map: map,
center: [-105.567, 41.313193],
zoom: 16
});
view.ui.add (new Legend ({view: view}), "bottom-left");
let highlight;
view.on ("click", function (event)
{
clearMap ();
queryFeatures (event);
showAtts (event);
});
function queryFeatures (screenPoint)
{
const point = view.toMap (screenPoint);
// Query the for the object ids within 800m from where the user clicked
layer.queryObjectIds ({
geometry: point,
spatialRelationship: "intersects",
distance: 10,
units: "meters",
returnGeometry: false,
outFields: ["*"]
})
.then (function (objectIds)
{
if (!objectIds.length) {
showMessage ();
return;
}
// Highlight the query-area on the map
view.whenLayerView (layer).then (function (layerView)
{
if (highlight) {
highlight.remove ();
}
highlight = layerView.highlight (objectIds);
});
// Query the for the attachments from the object ids found
return layer.queryAttachments ({
attachmentTypes: ["image/jpeg"],
objectIds: objectIds
});
})
.then (function (attachmentsByFeatureId)
{
if (!attachmentsByFeatureId) {
return;
}
if (Object.keys (attachmentsByFeatureId).length === 0) {
const infoP = document.createElement ("p");
infoP.innerHTML = "<b>There are no building image/jpeg attachments located in your query area.</b>";
document.getElementById ("queryResults").appendChild (infoP);
}
// Display the attachments
Object.keys (attachmentsByFeatureId)
.forEach (function (objectId)
{
const attachments = attachmentsByFeatureId[objectId];
attachments.forEach (function (attachment)
{
const image = document.createElement ("img");
image.src=attachment.url;
image.className = "queryImg";
document.getElementById ("queryResults").appendChild (image);
});
});
})
.catch (function (error)
{
showMessage ();
})
}
function showMessage ()
{
clearMap ();
const infoP = document.createElement ("p");
infoP.innerHTML = "<b>There are no building image/jpeg attachments located in your query area. Please click within the feature layer to get results.</b>";
document.getElementById ("queryResults").appendChild (infoP);
}
// Clear attachments from div
function clearMap ()
{
if (highlight) {
highlight.remove ();
}
const att = document.getElementById ("queryResults");
while (att.firstChild) {
att.removeChild (att.firstChild);
}
}
});
</script>
</head>
<body>
<div id="attachmentsDiv" class="esri-widget">
<h2 align="center"> <input id="LogoA" title="UW Website" type="image" alt="LogoA" src="Icons/UWWebA.png"
onClick="javascript: return popitup ('http://www.uwyo.edu/')" /></h2>
<h2>Building Photos</h2>
<p>Click somewhere in the map to query for images of trees located on a block within 800m of your desired location.
</p>
<div id="queryResults"></div>
</div>
<div id="viewDiv"></div>
</body>
</html>
... View more
03-05-2024
05:59 AM
|
0
|
0
|
2072
|
|
POST
|
I am still getting a broken picture. Can you show the rest of the code? I may be missing where getGraphics is being used. My code is below Thanks!
... View more
03-04-2024
04:21 PM
|
0
|
0
|
2079
|
|
POST
|
Is there a way to do a carriage return using this method?
... View more
06-27-2023
09:32 AM
|
0
|
0
|
3077
|
|
POST
|
Thanks for the information! I did try the Popup Actions. I need to work with it a bit more to get it to work.
... View more
06-27-2023
09:17 AM
|
0
|
0
|
688
|
|
POST
|
I used to be able to add a button to the pop code (see below and attachments). It worked until after ArcGIS API for JavaScript (legacy) 3.36. Anything after that the html tags do not work for buttons, inputs, etc. Is there a different way to do this? countyTemplate = new PopupTemplate ({
title: "Counties",
description: "<button type='button'onClick=javascript:countyAssessor('{jurisdicti}')>Click for {jurisdicti} County Assessor web page</button>"
});
... View more
06-23-2023
07:38 AM
|
0
|
0
|
7769
|
|
IDEA
|
I am using the JavaScript 3.x API to create a PDF print out from a print service. I would like tp only show the feature that are shown in the map extent. For example, I use the BLM Surface owner layer. There are about 20 different symbol classes in the symbology. Most of the time the user is zoomed in and there are two to three different symbols. When the map is exported all the symbols show up.
... View more
08-16-2022
11:47 AM
|
1
|
1
|
809
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-16-2022 11:47 AM | |
| 1 | 06-28-2017 06:36 AM | |
| 1 | 06-23-2016 06:54 AM | |
| 1 | 03-19-2015 01:21 PM | |
| 1 | 07-20-2017 06:07 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-12-2025
07:31 AM
|