POST
|
@LearnThenShare Sound like you are needing this link then. https://doc.arcgis.com/en/web-appbuilder/10.9.1/create-apps/add-custom-widgets.htm
... View more
09-14-2022
08:04 AM
|
1
|
0
|
1404
|
POST
|
Jay, You are on the right tract with the distance and unit stuff. A far as querying the buffer graphic. Just get the graphic from the bufferGraLayer graphics property. let buffGeom = bufferGraLayer.graphics[0].geometry; Or just keep a global var of the buffGeom in your app from the BufferGeom function.
... View more
09-13-2022
06:52 AM
|
0
|
6
|
1531
|
POST
|
If the field type is string then you can not do numeric evaluations like greater than...
... View more
09-13-2022
06:05 AM
|
0
|
0
|
244
|
POST
|
Jay, So here is what I would do. <html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Draw polyline | Sample | ArcGIS API for JavaScript 4.24</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.24/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.24/"></script>
<style>
html,
body,
#viewDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
.topcorner {
position: absolute;
top: 0;
right: 0;
width: 185px;
border: 1px solid black;
text-align: center;
}
.topcorner2 {
position: absolute;
bottom: 16;
right: 0;
width: 185px;
border: 1px solid black;
text-align: center;
}
</style>
<script>
require([
"esri/Map", "esri/views/MapView", "esri/views/draw/Draw", "esri/Graphic", "esri/geometry/geometryEngine",
"esri/geometry/support/webMercatorUtils",
"esri/layers/GraphicsLayer",
"dojo/dom",
"dojo/domReady!"
], (Map, MapView, Draw, Graphic, geometryEngine, webMercatorUtils, GraphicsLayer, dom) => {
var geometryType = "nothing"
let bufferGralayer = new GraphicsLayer({id: "BufferGraLyr"});
const map = new Map({
basemap: "gray-vector",
layers: [bufferGralayer]
});
const view = new MapView({
container: "viewDiv",
map: map,
zoom: 10,
center: [-77.367, 37.55]
});
// add the button for the draw tool
view.ui.add("clear-button", "top-left");
view.ui.add("line-button", "top-left");
view.ui.add("point-button", "top-left");
view.ui.add("polygon-button", "top-left");
const draw = new Draw({
view: view
});
document.getElementById("clear-button").onclick = () => {
view.graphics.removeAll();
bufferGralayer.removeAll();
geometryType = "nothing";
document.getElementById("info2").textContent = geometryType;
};
document.getElementById("point-button").onclick = () => {
view.graphics.removeAll();
geometryType = "point";
document.getElementById("info2").textContent = geometryType;
// creates and returns an instance of PolyLineDrawAction
const action = draw.create("point");
// focus the view to activate keyboard shortcuts for sketching
view.focus();
// PointDrawAction.cursor-update
// Give a visual feedback to users as they move the pointer over the view
action.on("cursor-update", function (evt) {
updateVerticesPoint(evt.coordinates);
});
// PointDrawAction.draw-complete
// Create a point when user clicks on the view or presses "C" key.
action.on("draw-complete", function (evt) {
updateVerticesPoint(evt.coordinates);
});
};
document.getElementById("polygon-button").onclick = () => {
view.graphics.removeAll();
geometryType = "polygon";
document.getElementById("info2").textContent = geometryType;
// creates and returns an instance of PolyLineDrawAction
const action = draw.create("polygon");
// focus the view to activate keyboard shortcuts for sketching
view.focus();
// listen polylineDrawAction events to give immediate visual feedback
// to users as the line is being drawn on the view.
action.on(
[
"vertex-add",
"vertex-remove",
"cursor-update",
"redo",
"undo",
"draw-complete"
],
updateVerticesPolygon
);
};
document.getElementById("line-button").onclick = () => {
view.graphics.removeAll();
geometryType = "line";
document.getElementById("info2").textContent = geometryType;
// creates and returns an instance of PolyLineDrawAction
const action = draw.create("polyline");
// focus the view to activate keyboard shortcuts for sketching
view.focus();
// listen polylineDrawAction events to give immediate visual feedback
// to users as the line is being drawn on the view.
action.on(
[
"vertex-add",
"vertex-remove",
"cursor-update",
"redo",
"undo",
"draw-complete"
],
updateVerticesLine
);
};
// https://developers.arcgis.com/javascript/latest/esri-icon-font/
function updateVerticesPoint(coordinates) {
//// create a polyline from returned vertices
//if (event.vertices.length > 0) {
// const result = createGraphicPoint(event);
//}
view.graphics.removeAll();
let point = {
type: "point", // autocasts as /Point
x: coordinates[0],
y: coordinates[1],
spatialReference: view.spatialReference
};
let graphic = new Graphic({
geometry: point,
symbol: {
type: "simple-marker", // autocasts as SimpleMarkerSymbol
style: "circle",
color: [51, 102, 153, 0.8],
size: "16px",
outline: { // autocasts as SimpleLineSymbol
color: [0, 0, 0],
width: 1
}
}
});
view.graphics.add(graphic);
BufferGeom(graphic.geometry, 500);
}
function updateVerticesPolygon(event) {
// create a polyline from returned vertices
if (event.vertices.length > 1) {
const result = createGraphicPolygon(event);
}
}
function updateVerticesLine(event) {
// create a polyline from returned vertices
if (event.vertices.length > 1) {
const result = createGraphicLine(event);
// if the last vertex is making the line intersects itself,
// prevent the events from firing
if (result.selfIntersects) {
event.preventDefault();
}
}
}
function createGraphicPoint(event) {
const vertices = event.vertices;
view.graphics.removeAll();
//
// a graphic representing the polyline that is being drawn
const graphicPnt= new Graphic({
geometry: {
type: "point",
spatialReference: view.spatialReference
},
symbol: {
type: "simple-marker", // autocasts as new SimpleFillSymbol
color: [51, 102, 153, 0.8],
outline: {
color: [255, 255, 255],
width: 1
}
}
});
view.graphics.add(graphicPnt);
BufferGeom(graphicPnt.geometry, 500);
}
function createGraphicPolygon(event) {
const vertices = event.vertices;
view.graphics.removeAll();
// a graphic representing the polyline that is being drawn
const graphicPoly = new Graphic({
geometry: {
type: "polygon",
rings: vertices,
spatialReference: view.spatialReference
},
symbol: {
type: "simple-fill", // autocasts as new SimpleFillSymbol
color: [227, 139, 79, 0.8],
outline: {
color: [45, 55, 255],
width: 1
}
}
});
view.graphics.add(graphicPoly);
BufferGeom(graphicPoly.geometry, 500);
}
function createGraphicLine(event) {
const vertices = event.vertices;
view.graphics.removeAll();
// a graphic representing the polyline that is being drawn
const graphicLine = new Graphic({
geometry: {
type: "polyline",
paths: vertices,
spatialReference: view.spatialReference
},
symbol: {
type: "simple-line", // autocasts as new SimpleFillSymbol
color: [4, 90, 141],
width: 1,
cap: "round",
join: "round"
}
});
// check if the polyline intersects itself.
const intersectingSegment = getIntersectingSegment(graphicLine.geometry);
// Add a new graphic for the intersecting segment.
if (intersectingSegment) {
view.graphics.addMany([graphicLine, intersectingSegment]);
}
// Just add the graphic representing the polyline if no intersection
else {
view.graphics.add(graphicLine);
BufferGeom(graphicLine.geometry, 500);
}
// return intersectingSegment
return {
selfIntersects: intersectingSegment
};
}
function BufferGeom(geom, dist) {
const buffGeom = geometryEngine.buffer(geom, dist, "feet");
const buffgra = new Graphic({
geometry: buffGeom,
symbol: getGeomSymbol()
});
bufferGralayer.removeAll();
bufferGralayer.add(buffgra)
}
function getGeomSymbol() {
let sym;
switch(geometryType) {
case "point":
sym = {
style: "circle",
size: 22,
type: "simple-marker",
color: [255, 0, 0, 0.8],
outline: {
color: [255, 0, 0],
width: 1
}
}
break;
case "line":
case "polygon":
sym = {
type: "simple-fill", // autocasts as new SimpleFillSymbol
color: [255, 0, 0],
width: 1,
cap: "round",
join: "round"
}
break;
default :
sym = null;
}
return sym;
}
// function that checks if the line intersects itself
function isSelfIntersecting(polyline) {
if (polyline.paths[0].length < 3) {
return false;
}
const line = polyline.clone();
//get the last segment from the polyline that is being drawn
const lastSegment = getLastSegment(polyline);
line.removePoint(0, line.paths[0].length - 1);
// returns true if the line intersects itself, false otherwise
return geometryEngine.crosses(lastSegment, line);
}
// Checks if the line intersects itself. If yes, change the last
// segment's symbol giving a visual feedback to the user.
function getIntersectingSegment(polyline) {
if (isSelfIntersecting(polyline)) {
return new Graphic({
geometry: getLastSegment(polyline),
symbol: {
type: "simple-line", // autocasts as new SimpleLineSymbol
style: "short-dot",
width: 3.5,
color: "yellow"
}
});
}
return null;
}
// Get the last segment of the polyline that is being drawn
function getLastSegment(polyline) {
const line = polyline.clone();
const lastXYPoint = line.removePoint(0, line.paths[0].length - 1);
const existingLineFinalPoint = line.getPoint(
0,
line.paths[0].length - 1
);
return {
type: "polyline",
spatialReference: view.spatialReference,
hasZ: false,
paths: [
[
[existingLineFinalPoint.x, existingLineFinalPoint.y],
[lastXYPoint.x, lastXYPoint.y]
]
]
};
}
function showCoordinates(evt) {
var point = view.toMap({
x: evt.x,
y: evt.y
});
//the map is in web mercator but display coordinates in geographic (lat, long)
var mp = webMercatorUtils.webMercatorToGeographic(point);
//display mouse coordinates
dom.byId("info").innerHTML = mp.x.toFixed(6) + ", " + mp.y.toFixed(6);
}
view.when(function () {
//after map loads, connect to listen to mouse move & drag events
view.on("pointer-move", showCoordinates);
});
});
</script>
</head>
<body>
<!-- https://developers.arcgis.com/javascript/latest/esri-icon-font/ -->
<div id="viewDiv">
<div id="clear-button" class="esri-widget esri-widget--button esri-interactive" title="Clear Grpahics">
<span class="esri-icon-erase"></span>
</div>
<div id="point-button" class="esri-widget esri-widget--button esri-interactive" title="Draw point">
<span class="esri-icon-map-pin"></span>
</div>
<div id="line-button" class="esri-widget esri-widget--button esri-interactive" title="Draw polyline">
<span class="esri-icon-polyline"></span>
</div>
<div id="polygon-button" class="esri-widget esri-widget--button esri-interactive" title="Draw polygon">
<span class="esri-icon-polygon"></span>
</div>
<div class="topcorner">
<span id="info"></span>
</div>
<div class="topcorner2">
<div id="info2">fghfghf</div>
</div>
</div>
</body>
</html>
... View more
09-13-2022
06:02 AM
|
1
|
8
|
1537
|
POST
|
So this is the response I get from my web service {"suggestions":["123","1231","1232","1233","1234","1235","1236","1237","1238","1239","12333","12334","12335","12335","12336","12337","12339","12340","12341","12342","12343","12344","12345","12346","12347","12348","12349"]} And yours is: [{"texto":"Arroio Areal"},{"texto":"Arroio Arenal"},{"texto":"Arroio Baje"},{"texto":"Arroio Bolacha"},{"texto":"Arroio Candiota"},{"texto":"Arroio Caracá"},{"texto":"Arroio Castelhano"},{"texto":"Arroio Cavera"},{"texto":"Arroio Chico Loma"},{"texto":"Arroio Chuí"},{"texto":"Arroio da Pintada"},{"texto":"Arroio das Lavras"},{"texto":"Arroio Del Rei"},{"texto":"Arroio Do Bote"},{"texto":"Arroio dos Ratos"},{"texto":"Arroio Francisco Alves"},{"texto":"Arroio Garupa"},{"texto":"Arroio Grande"},{"texto":"Arroio Ibacuru"},{"texto":"Arroio Ibirocai"},{"texto":"Arroio Jacaré"},{"texto":"Arroio Jaguarão-Chico"},{"texto":"Arroio João Dias"},{"texto":"Arroio Não Sabia"},{"texto":"Arroio Pelotas"},{"texto":"Arroio Pequiri"},{"texto":"Arroio Petim"},{"texto":"Arroio Pinhal"},{"texto":"Arroio Pirai"},{"texto":"Arroio Portão"},{"texto":"Arroio Ribeiro"},{"texto":"Arroio Ribeiro Pequeno"},{"texto":"Arroio Saicã"},{"texto":"Arroio São Lourenço"},{"texto":"Arroio Sutil"},{"texto":"Arroio Taquara"},{"texto":"Arroio Taquarembozinho"},{"texto":"Arroio Telho"},{"texto":"Arroio Vacaquá"},{"texto":"Arroio Velhaco"},{"texto":"Arroio Vira Carreta"},{"texto":"Lagoa dos Barros"},{"texto":"Rio Carreiro"}] The BIG difference is you are returning an array of objects and mine is returning an object that has a property containing an array of strings... So in the def.then of my code I am doing array.map(resp.suggestions, lang.hitch(this, function(val){ iterating through the resp.suggestions (where resp is an object and suggestions is a property of that object and is an array). In your case it would be more like: array.map(resp, lang.hitch(this, function(val){
var item = new MenuItem({
label: val.texto,
onClick: lang.hitch(this, function (evt) {
...
... View more
09-09-2022
01:15 PM
|
1
|
1
|
1218
|
POST
|
So are you saying that in the Suggest_TextBox.js code you are getting the results you would expect from your C# web service inside the def.then portion of the _popup function? I do not see 'arr' variable in the code I provided so I am a little confused.
... View more
09-09-2022
12:11 PM
|
0
|
3
|
1230
|
DOC
|
@VictoriaJadot That would most likely require customization to the search widget.
... View more
09-09-2022
08:52 AM
|
0
|
0
|
7907
|
DOC
|
@Ming Sorry to say that that has nothing to do with the widget and everything to do with how the print service on ArcGIS server handles the heatmap layer type.
... View more
09-08-2022
11:36 AM
|
0
|
0
|
1532
|
DOC
|
@VictoriaJadot So I just did some testing in a web scene and had no issues using this widget when the clicked layer has a popup enabled/configured (and buildings are highlighted). I can see from your image that you still have the scene views popup enabled (and it shows not fields, so that leads me to wonder if your buildings layer has popups configured). In this widgets settings you are cautioned to disable the views popups unless you want the views popup on the map and this widgets panel to show the same data.
... View more
09-08-2022
10:00 AM
|
0
|
0
|
7929
|
DOC
|
@JamesFaron There seems to be some issue right now downloading apps from 1.9. So I have patched 1.7 version of this widget. I did test these same changes in EB 1.9 and it works, but I just cannot download the 1.9 version app of this widget.
... View more
09-08-2022
09:24 AM
|
0
|
0
|
7939
|
POST
|
@ScottHiggins_PVGIS I am getting the same issue today (9/8/22). Strange as I have downloaded a few apps from 1.9 last month. Have you opened a ticket with Tech Support?
... View more
09-08-2022
08:23 AM
|
2
|
6
|
1816
|
DOC
|
@JamesFaron What version of EB are you running? I believe I have a fix that is working but I need to know if I need t patch 1.7 or just release the fix in 1.9 version of this widget.
... View more
09-08-2022
07:57 AM
|
0
|
0
|
7953
|
POST
|
@JohnCodd Custom widgets have two options WAB Dev deployed on your own web server, and ArcGIS Enterprise (Portal) that your organization has deployed. If you are working with just AGOL WAB then you are out of luck.
... View more
09-07-2022
06:02 AM
|
1
|
2
|
1438
|
DOC
|
@VictoriaJadot I have done any testing in 3D. Are there any errors shown in your web browsers web console?
... View more
09-07-2022
05:56 AM
|
0
|
0
|
7987
|
Title | Kudos | Posted |
---|---|---|
1 | 03-03-2017 07:40 AM | |
1 | 11-20-2018 11:33 AM | |
1 | 10-15-2020 08:27 AM | |
1 | 05-25-2018 11:59 AM | |
1 | 05-25-2018 01:28 PM |
Online Status |
Offline
|
Date Last Visited |
4 weeks ago
|