POST
|
OK, just to clarify; Should I add that `require({ paths: { moment: '<path to moment>}});` at the top and then add it underneath in my `define({'moment'}), as well?
... View more
02-09-2022
09:10 AM
|
0
|
0
|
2504
|
POST
|
In what file do you propose adding the above code? The main widget.js? If so, I am using WabVersion 2.20, and I don't see any 'require'. I do have 'define(['<path to libs>'], function(<lib_name>) {<code goes here>});' in my widget.js file? Is there another file I would add that to? I already have it in my main init.js file as mentioned, but that does not seem to guarantee it gets loaded in the proper order: From init.js: resources = resources.concat([ window.apiUrl + 'dojo/resources/dojo.css', window.apiUrl + 'dijit/themes/claro/claro.css', window.apiUrl + 'esri/css/esri.css', window.path + 'jimu.js/css/jimu-theme.css', window.path + 'libs/moment/moment.min.js', window.path + 'libs/moment/twix.js', window.path + 'libs/moment/moment-timezone-with-data.min.js', ])
... View more
02-09-2022
07:53 AM
|
0
|
2
|
2511
|
POST
|
I am working on a Web AppBuilder application that uses 3rd party libraries. One of these libraries includes the Moment and Moment-Timezone libraries. On load, I immediately get and error: 'Uncaught TypeError: Cannot read properties of undefined (reading 'tz')'. Researching this; I found an article that point to the source of this problem being due to the moment-timezone-with-data-min.js file loading before the moment-min.js file. I am not sure where to make this change within my app. It looks like the libs get loaded as resources in my `init.js` file and I have placed them in the proper order there. Is there another folder or file with dependencies? I also see that in the libs folder, there is a moment folder and the files are in this order. How can I change this order so they load properly. Or is there another issue I may be overlooking?
... View more
02-03-2022
07:17 AM
|
0
|
4
|
2533
|
POST
|
OK, I got it working. I have removed the `if` part and it seems to be working fine. Thanks for the assist @KenBuja , it was totally the .stationary != true that threw everything off. watchUtils.init(view, "extent", function (extent) { // Sync the overview map location // whenever the 3d view is stationary console.log(view.stationary); //if (view.stationary) { overView .goTo({ center: view.center, zoom: view.zoom, scale: view.scale * 2 * Math.max(view.width / overView.width, view.height / overView.height) }) .catch(function (error) { // ignore goto-interrupted errors if (error.name !== "view:goto-interrupted") { console.error(error); } }); //} extent3Dgraphic.geometry = extent; });
... View more
03-19-2021
01:41 PM
|
1
|
0
|
3498
|
POST
|
This is exactly the problem. So, since I am not using the 3D SceneView, how to I overcome this issue. Should I simply remove the `if`(view.stattionary) {}` part? I still need that extent to set `extent3Dgraphic.geometry = extent;`
... View more
03-19-2021
10:22 AM
|
0
|
1
|
3507
|
POST
|
This seemed to work for syncing the views, but I can't figure out how to get the extent 3D graphic ( the opaque rectangle that shows the extent) to work inside the sync. Any ideas about that?
... View more
03-19-2021
07:12 AM
|
0
|
0
|
3515
|
POST
|
I have created an overview map widget for my web app. I am using the `arcGIS API for Javascript` version 4.17. My overview map is separate from my main map as I don't want to bring in all the layers from my main map in the overview. I have basically followed the API documentation as a guide // Create Maps var map = new Map({ basemap: "streets-vector", layers: [GA_Layers, study_layer] }); // Create another Map, to be used in the overview "view" const overviewMap = new Map({ basemap: "topo-vector" }); // Create Map Views. Add the map to a MapView const view = new MapView({ container: "viewDiv", map: map, center: [-83.9073, 30.8417], zoom: 9, highlightOptions: { color: "red" }, popup: { actions: [], dockEnabled: true, dockOptions: { buttonEnabled: true, breakpoint: false } } }); // Create the MapView for overview map var overView = new MapView({ container: "overviewDiv", map: overviewMap, constraints: { rotationEnabled: false } }); I then create some code to `sync` the overview map zoo, center, and scale to the main view map. However, this does not work. overView.when(function () { view.when(function () { setup(); }); }); function setup() { const extent3Dgraphic = new Graphic({ geometry: null, symbol: { type: "simple-fill", color: [0, 0, 0, 0.5], outline: null } }); overView.graphics.add(extent3Dgraphic); watchUtils.init(view, "extent", function (extent) { // Sync the overview map location // whenever the 3d view is stationary if (view.stationary) { overView .goTo({ center: view.center, zoom: view.zoom, scale: view.scale * 2 * Math.max( view.width / overView.width, view.height / overView.height ) }) .catch(function (error) { // ignore goto-interrupted errors if (error.name !== "view:goto-interrupted") { console.error(error); } }); } extent3Dgraphic.geometry = extent; }); } Essentially, the overview map is not syncing with the main map and doesn't pan or zoom with it after launch. Any ideas as to what I am doing wrong here?
... View more
03-18-2021
12:39 PM
|
0
|
7
|
3578
|
POST
|
I have placed 2 widgets (baseMapGallery, LayerList) inside a small map in a rather large popup. To keep it from crowding out the view, I am trying to use an Expand to launch it from a small icon button in the top-right corner of the map view. As you can see, there are 2 maps in this popup; each with its own separate div/view, independent of the main map view in the foreground. Currently, when I try to launch the widgets from the icon button (Expand), it attempts to open in the main map view to the right of the popup. Also, there is nothing showing (no basmaps, no layer list). Here's my current code for the left map panel with the widgets, expand, and a handler: //Left panel map
var popupDiv1 = document.createElement("div");
popupDiv1.classList.add("mapViewLeft");
popupDiv1.style.marginBottom = "10px";
var popupView1 = new MapView({
container: popupDiv1,
map: map_left,
actions: [],
//center: view.center,
center: [lon, lat],
zoom: view.zoom,
//scale:
// view.scale *
// 2 *
// Math.max(view.width / 250, view.height / 250),
constraints: {
rotationEnabled: false
},
ui: {
components: ["zoom"]
}
});
var layerList_left = new LayerList({
view: popupView1,
listItemCreatedFunction: function (event) {
const item = event.item;
if (item.layer.type !== "group") {
// don't show legend twice
item.panel = {
content: "legend",
open: false
};
}
}
});
bgExpandLayerList_2 = new Expand({
view: popupView1,
content: layerList_left.container,
expandIconClass: "esri-icon-layer-list"
});
var basemapGallery_2 = new BasemapGallery({
view: popupView1,
container: document.createElement("div")
});
bgExpandBaseMapGallery_2 = new Expand({
view: popupView1,
content: basemapGallery.container,
expandIconClass: "esri-icon-basemap"
});
expandHandle_a = watchUtils.pausable(bgExpandLayerList_2, "expanded", function (newValue, oldValue) {
if (newValue === true) {
expandHandle_a.pause();
setTimeout(function () {
expandHandle_b.resume();
}, 100);
} else {
expandHandle_a.resume();
}
if (bgExpandLayerList_2.expanded) {
bgExpandLayerList_2.collapse();
}
});
expandHandle_b = watchUtils.pausable(bgExpandBaseMapGallery_2, "expanded", function (newValue, oldValue) {
if (newValue === true) {
expandHandle_b.pause();
setTimeout(function () {
expandHandle_a.resume();
}, 100);
} else {
expandHandle_b.resume();
}
if (bgExpandBaseMapGallery_2.expanded) {
bgExpandBaseMapGallery_2.collapse();
}
});
popupView1.ui.add(bgExpandLayerList_2, "top-right");
popupView1.ui.add(bgExpandBaseMapGallery_2, "top-right"); I've tried removing the handler and just adding a single widget, but I am still seeing the same problem (opening in the wrong view). Any ideas as to what I am doing incorrectly here? The widget works fine by itself (see right panel map), just not with the Expand. Note: I have a baseMapGallery and LayerList widget in the main view as well that are both working. I have named the variable differently for each. Is there a restriction on adding more than one of the same widget Expand in a web app?
... View more
01-19-2021
10:23 AM
|
0
|
0
|
1073
|
POST
|
Essentially, the DOM Node example from ESRI is in CodePen. I am just trying to add my table to the popup.contents. Here's the link: https://codepen.io/pen?&editors=100
... View more
01-06-2021
11:21 AM
|
0
|
1
|
1759
|
POST
|
I am using a popup on my mapView from arcGIS API for Javascript 4.17. When the user opens the popup, I have set the following attributes: view.popup.open({
// Set the popup's title to the coordinates of the clicked location
title: "Location Coordinates: [" + lon + ", " + lat + "]",
location: event.mapPoint, // Set the location of the popup to the clicked location
content: setContentInfo(view.center, view.scale),
actions: [risk_snapshot, ble_report, print_report, lidar_report]
}); In the popup, I am adding some smaller maps using a function called setContentInfo that returns a "masterDiv" DOM node with the maps. However, I want to add an additional DOM Node outside of that div to the content. The function is essentially setup as below. How can you add multiple items -DOM Nodes to content? function setContentInfo(center, scale) {
var popupDiv1 = document.createElement("div");
popupDiv1.classList.add("mapViewLeft");
var popupView1 = new MapView({
container: popupDiv1,
map: map,
actions: [],
center: view.center,
zoom: view.zoom,
scale:
view.scale *
2 *
Math.max(view.width / 250, view.height / 250),
constraints: {
rotationEnabled: false
},
ui: {
components: []
}
});
var popupDiv2 = document.createElement("div");
...
var popupMasterDiv = document.createElement("div");
popupMasterDiv.id = "masterDiv";
popupMasterDiv.style.width = "650px";
popupMasterDiv.style.height = "450px";
var theDiv = document.getElementById("masterDiv");
popupMasterDiv.appendChild(popupDiv1);
popupMasterDiv.appendChild(popupDiv2);
popupMasterDiv.appendChild(ble_report);
// Return a dom node
//return popupView.container;
return popupMasterDiv;
} To test, I have tried adding var test = document.createElement("div"); test.textContent = "Hey"; and then adding popupMasterDiv.appendChild(popupDiv1);
popupMasterDiv.appendChild(popupDiv2);
popupMasterDiv.appendChild(test); but it puts the "Hey" in the middle of the 2 maps. I also tried adding the above straight to the content like this: content: setContentInfo(view.center, view.scale) + test, But that removes the map content and only displays "Hey" What I want is to add a nice little table in its own div under the maps with something like this. What am I doing wrong here; how can I achieve this: var table1 = "<table id="info">
<tr>
<th>Location</th>
<th> </th>
</tr>
<tr>
<td>Coordinates</td>
<td>Parcel ID</td>
</tr>
<tr>
<td>123.345, -43.432</td>
<td>12345</td>
</tr>
</table>"
... View more
01-06-2021
05:41 AM
|
1
|
3
|
1792
|
POST
|
I have an esri popup in my web app MapView: // Add the map to a MapView
const view = new MapView({
container: "viewDiv",
map: map,
center: [-82.9001, 32.1656],
zoom: 8,
popup: {
//actions: [risk_snapshot],
actions: [],
dockEnabled: true,
dockOptions: {
buttonEnabled: true,
breakpoint: false
}
}
});
...
view.popup.open({
// Set the popup's title to the coordinates of the clicked location
title: "Location Coordinates: [" + lon + ", " + lat + "]",
location: event.mapPoint, // Set the location of the popup to the clicked location
content: setContentInfo(view.center, view.scale),
actions: [risk_snapshot]
}); I also have a simple Bootstrap Navbar in my app: <nav class="navbar navbar-inverse navbar-dark bg-dark" style="margin-bottom: 5px;">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapibleMenu">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand" style="color: cornflowerblue;">GA Map Viewer</a>
</div>
<div class="collapse navbar-collapse" id="collapibleMenu">
<ul class="nav navbar-nav navbar-right">
<li><a href="#" style="color: cornflowerblue;">Home</a></li>
</ul>
</div>
</div>
</nav>
<div id="viewDiv"></div>
For some reason, whenever, I close the popup, the navbar disappears. Any reason why this would happen or suggestions on how to fix it?
... View more
12-24-2020
06:48 AM
|
1
|
0
|
630
|
POST
|
I am trying to load a module called 'geojson2h3' in my `NodeJS` app with the arcgis api for javascript methods to render the hexagons with the h3 spatial index. After running `npm install geojson2h3` into my node_modules folder, I tried following the initial code instructions given in `Github` to test it out: import geojson2h3 from 'geojson2h3'; const polygon = { type: 'Feature', geometry: { type: 'Polygon', coordinates: [ [ [-122.47485823276713, 37.85878356045377], [-122.47504834087829, 37.86196795698972], [-122.47845104316997, 37.86010614563313], [-122.47485823276713, 37.85878356045377] ] ] } }; const hexagons = geojson2h3.featureToH3Set(polygon, 10); // -> ['8a2830855047fff', '8a2830855077fff', '8a283085505ffff', '8a283085506ffff'] const feature = geojson2h3.h3SetToFeature(hexagons); // -> {type: 'Feature', properties: {}, geometry: {type: 'Polygon', coordinates: [...]}} This method throws a `SyntaxError: Cannot use import statement outside a module` error. I then tried using the `NodeJS require` method as such: `const geojson2h3 = require('geojson2h3');`, replacing the `import` statement. This throws an `Uncaught Error: undefinedModule` error. The package shows in my `package.json` filer. What did I do wrong here?
... View more
08-23-2020
05:04 PM
|
0
|
0
|
1996
|
POST
|
OK, I am having some issues using on("load") as these maps are only rendered after a button is clicked and there is no id = "map1" on load.
... View more
06-02-2020
11:05 AM
|
0
|
1
|
1548
|
POST
|
I tried applying this in a few different places, but it didn't seem to work. My latest attempt I added it in the Default.aspx file that has the front end .html. The scenario compare maps (there can be up to 3) are here: <div id="compareMaps" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"> <div style="height: 100%"> <div id = "mapDiv1"> <div id="map1" data-dojo-type="dijit.layout.ContentPane" title="map1"></div> <div id="mapGridLabel1"></div> <div id= "mapGrid1" data-dojo-type="dijit.layout.ContentPane" title="Top Road SEG_ID"></div> </div> <div id = "mapDiv2"> <div id= "map2" data-dojo-type="dijit.layout.ContentPane" title="map2"></div> <div id="mapGridLabel2"></div> <div id= "mapGrid2" data-dojo-type="dijit.layout.ContentPane" title="Top Road SEG_ID"></div> </div> <div id = "mapDiv3"> <div id= "map3" data-dojo-type="dijit.layout.ContentPane" title="map3"></div> <div id="mapGridLabel3"></div> <div id= "mapGrid3" data-dojo-type="dijit.layout.ContentPane" title="Top Road SEG_ID"></div> </div> </div> <div id= "legendCompareMap" data-dojo-type="dijit.layout.ContentPane" title=""></div> </div> So, then I added the following in the <script> tag: map.on("load", function () { registry.byId("map1").on("resize", function () { clearTimeout(resizeTimer); resizeTimer = setTimeout(function () { map.resize(); map.reposition(); }, 500); }); registry.byId("map2").on("resize", function () { clearTimeout(resizeTimer); resizeTimer = setTimeout(function () { map.resize(); map.reposition(); }, 500); }); registry.byId("map3").on("resize", function () { clearTimeout(resizeTimer); resizeTimer = setTimeout(function () { map.resize(); map.reposition(); }, 500); }); }); I tried clearing the cache but the issue persists.
... View more
06-02-2020
07:32 AM
|
0
|
1
|
1548
|
POST
|
I have a web application that incorporate an infoTemplate (esriPopup) when the user clicks on a road feature in the map. This works fine in the main map, but I have additional maps that compare 2 preloaded scenario maps. When the user zooms in to one of the scenario compare maps, they should be able to click one of the road features and the infoTemplate is displayed. What I am noticing is there is a slight offset of where the user has to click in order to get the infoTemplat e to display properly. In other words, the user has to click slightly above the feature layer in order to select it and trigger the infoTemplate to display correctly. If the user click directly on the road feature, it displays "No information available". It's a .NET application with most of the client side functionality in an AMD-style main.js file. There is an esri.css and Style.css that controls most of the styling. I am refactoring the application and am having trouble even determining where the issue originates from (is it the cursor, the infoTemplate , or the roadsLayer settings?) The infoTemplate for the scenario compare maps looks like this: it = new InfoTemplate("Feature Info");
it.setContent(lang.hitch(map,generateInfoContent));
its = {};its[idx] = { infoTemplate: it, layerUrl: null }
map.getLayersVisibleAtScale()[1].setInfoTemplates(its); The method .getLayersVisibleAtScale() seems to be an esri method of class map but I have no clue why this would produce a slick offset in selecting the layer. Any ideas as to how to resolve this?
... View more
06-02-2020
06:16 AM
|
0
|
5
|
1623
|
Title | Kudos | Posted |
---|---|---|
1 | 03-19-2021 01:41 PM | |
1 | 11-05-2019 07:44 AM | |
1 | 11-05-2019 09:58 AM | |
1 | 01-06-2021 05:41 AM | |
1 | 12-24-2020 06:48 AM |
Online Status |
Offline
|
Date Last Visited |
03-19-2022
10:13 PM
|