|
POST
|
I'm attempting to create a simple app that has a point featurelayer with some attributes. When selecting a point to view its popup info, how can I also make it become highlighted? This link to sample code does something similar in that it draws a border on a polygon: PopupTemplate with promise | ArcGIS API for JavaScript 4.8 This sample code does basically what I want in that when you select a point it becomes highlighted and has a popup: CSVLayer - Project points on the fly | ArcGIS API for JavaScript 4.8 Here's what I have so far: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Intro to Popups</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#layerToggle {
top: 20px;
right: 20px;
position: absolute;
z-index: 99;
background-color: white;
border-radius: 8px;
padding: 10px;
opacity: 0.75;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.8/esri/css/main.css">
<script src="https://js.arcgis.com/4.8/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer", //Require the FeatureLayer module
"dojo/dom",
"dojo/on",
"dojo/domReady!"
],
function(
Map, MapView, FeatureLayer, dom, on
) {
var warming = new FeatureLayer({
url: "https://services.arcgis.com/fGsbyIOAuxHnF97m/arcgis/rest/services/Warming_Centers_in_and_aroud_Will_County/FeatureServer/0?token=TYud8dGZfk-2we1iW0XCIvmarr1E52rLmntGUN5A4k6BFN1awEyGdeMj_GzNnUyJuFOqApzxytM5h2UjsZOxIaoyJ5EMVM_j9I3c9E6vL0PhP00Jx6huW-O6Qg3PAHrNU_XXSZOpFTySW08pmtxEd3_p8nF5c2q6cbUeu3bxQD1OGOVYp7ZEOepNPi4HU9sIHOxfnauKfZc98pw0ZdYkSLb6zlViZjKL6perWl6Bwg1DVKvSlet2BcwgEwq2ad8R",
id: "warming",
minScale: 5000000
});
var boundary = new FeatureLayer({
url:
"http://services.arcgis.com/fGsbyIOAuxHnF97m/arcgis/rest/services/Will_County_Boundary/FeatureServer/0?token=6vBDftNXDqbaZH6fbfhuDCeGkJFaWMSEPaeYDt6PbDBfVacnSMMD7PZS3QeCW6mDqgSFMK0tRjMyJyrxDPQ3rcjTNUCFpi0pfpU_mFLoKXGlT5FTGTPH3GjMqL9iQCqh9_ihX8D1-DQ5N_ptC-ic9bKeDLjqU2xQOv8wIRPjX5VwrtsQz_ltdanO49SVPaJ8F7EN6qWZMgvFw9V0iBbV4Iu0khjfjhuswBNzhjJa3I6q0epaze9AsPRVvVXJ5wik",
id: "boundary",
minScale: 5000000
});
var map = new Map({
basemap: "streets-night-vector",
layers: [warming, boundary]
});
var view = new MapView({
container: "viewDiv",
map: map,
scale: 500000,
center: [-88, 41.5]
});
var template = { // autocasts as new PopupTemplate()
title: "{FACILITY_NAME}",
content: [{
type: "fields",
fieldInfos: [{
fieldName: "FACILITY_TYPE",
label: "Facility Type",
visible: true,
}, {
fieldName: "ADDRESS",
label: "Address",
visible: true,
}, {
fieldName: "PHONE_NUMBER",
label: "Phone",
visible: true,
}, {
fieldName: "HOURS",
label: "Hours",
visible: true,
}]
}]
};
var featureLayer = new FeatureLayer({
url: "https://services.arcgis.com/fGsbyIOAuxHnF97m/arcgis/rest/services/Warming_Centers_in_and_aroud_Will_County/FeatureServer/0?token=TYud8dGZfk-2we1iW0XCIvmarr1E52rLmntGUN5A4k6BFN1awEyGdeMj_GzNnUyJuFOqApzxytM5h2UjsZOxIaoyJ5EMVM_j9I3c9E6vL0PhP00Jx6huW-O6Qg3PAHrNU_XXSZOpFTySW08pmtxEd3_p8nF5c2q6cbUeu3bxQD1OGOVYp7ZEOepNPi4HU9sIHOxfnauKfZc98pw0ZdYkSLb6zlViZjKL6perWl6Bwg1DVKvSlet2BcwgEwq2ad8R",
outFields: ["*"],
popupTemplate: template,
dockEnabled: true,
});
map.add(featureLayer);
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</span>
</body>
</html> And here is a seemingly relevant snippet from line 137 of the first sample code that I can't properly modify: view.popup.watch("selectedFeature", function(e) {
view.graphics.removeAll();
if (e && e.geometry) {
view.graphics.add(new Graphic({
geometry: e.geometry,
symbol: {
type: "simple-fill",
style: "none",
outline: {
color: "#6600FF",
width: 2
}
}
}));
}
});
... View more
08-17-2018
01:40 PM
|
0
|
2
|
2916
|
|
POST
|
Robert, Turns out I wasn't using Web AppBuilder Developer version. The entire time I thought I was since I had it downloaded and installed and the interfaces is exactly the same as non-developer version. The only difference is the url. In the case of the developer version it points to your machine, while the regular version points to your app on AGOL. So, i what I was doing was trying to deploy a downloaded version of the app from the Web AppBuilder through AGOL and that lead to all sorts of problems. It took a couple days of looking into server configerations and digging around, etc... You can see where this could be very confusing.
... View more
08-06-2018
01:18 PM
|
0
|
0
|
5524
|
|
POST
|
Robert, Thanks, I've only just begone to fill the developer role in my department so I wasn't aware of linters. I ran the json in a linter and fixed the two errors it found. After that it had no errors in that linter or any others. But, the app is still hung up with the same error message. The app runs on my local server. And that was without running the json through a linter.
... View more
08-06-2018
10:58 AM
|
0
|
2
|
5524
|
|
POST
|
ArcGIS Web Application Through my AGOL account, I created an app in WAB developer. It has two widgets and one feature layer, none of which require a subscription. After creating the app I downloaded the zip from my Content menu in AGOL. I extracted to a folder on our organizations server. In the Readme: it says to add the AppID to the config.json, which I did. I don't understand why it's asking to Add and Register the app when it's already in the Content with the App ID. (or maybe this is what the Note in the Readme is referring to). The error says it's unable to load the config.json. The only thing I did was add the AppID to the config file. I asked this same question in Geo Developers as well.
... View more
08-06-2018
09:38 AM
|
0
|
7
|
6040
|
|
POST
|
https://www.screencast.com/t/yETGFfbIBQ5 I followed this video and set up a self-signed certificate for my local server. Then I created a https site bindings in the IIS Manager, whereas before it the url to the app was http. It works now, but it's painfully slow and the side panel, top panel, widgets are missing. Only the basemap, points and popups are drawing. https://localhost/gisapi/Cooling/
... View more
08-06-2018
07:10 AM
|
0
|
0
|
4417
|
|
POST
|
I also closed all browsers and editors and reset the server. Then allowed full control of the wwwroot folder to all users: Still nothing.
... View more
08-03-2018
12:48 PM
|
0
|
0
|
4417
|
|
POST
|
I created this app in Web AppBuilder: ArcGIS Web Application I want to host it on our server. Here were my steps: 1. I first created a local test environment through the IIS Manager called C:\inetpub\wwwroot\GISApi 2. Through AGOL I clicked Create --> App: Using Web AppBuilder 3. Using Web AppBuilder developer version I created the app. It has two widgets, neither of which require a subscription to use. The content of the app (CSV file, hosted feature layer, web app, and the app) are all shared publicly. 4. After saving the finished app I went back to AGOL to download the zipfile. 5. I copied the zip to the GISApi folder then extracted it, and renamed the folder "Cooling". 6. I then tried running the app a few ways: a. I double clicked the index.html file, but the page never loaded: b. I put these URLs in the browser (Chrome) https://localhost/gisapi/Cooling/index.html , http://www.willcogis.org/website2014/gis/Cooling Here's what happened: There's no need for a proxy because the app's shared publicly. I then put a copy of the Cooling folder in our production folder. This is where the error message in the question title came from: I contacted ESRI and the tech downloaded the zip to his local server. He had the app up and running with no problems. I never went into the code at all so I'm guessing it might be my PC? At the moment I have a colleague in another department attempting to run the app from his PC on a different server.
... View more
08-03-2018
11:14 AM
|
0
|
4
|
6112
|
|
IDEA
|
For now I just double click the Layer in the Map Frame --> and in the Symbology tab click the color drop down --> Color Properties --> write down the RGB values. But, I'm all for having the Eye Dropper in Pro!!
... View more
08-02-2018
08:11 AM
|
0
|
1
|
8861
|
|
POST
|
Thanks for the help. @Dan I put mxd.save() after both try and except, but no difference. @michael I attempted saveACopy, but still no change in the data source. From what I read on Stack Exchange the findAndReplaceWorkspacePaths() function doesn't always work. I couldn't get it to work in three different scripts: arcpy - Getting findAndReplaceWorkspacePaths to work? - Geographic Information Systems Stack Exchange ArcGIS 10.2: ArcPy - how to replace workspace paths? - Geographic Information Systems Stack Exchange arcmap - ArcPy Changing Spatial Database Connection - Geographic Information Systems Stack Exchange Finally, I used this script, which has replaceWorkspaces(). And it worked. import os, arcpy
folderPath = r"\\gisfile\GISmaps\AtlasMaps\ATLAS_MAPS_18\Test Folder"
for fileName in [x for x in os.listdir(folderPath) if os.path.splitext(x)[1] == ".mxd"]:
fullPath = os.path.join(folderPath, fileName)
if os.path.isfile(fullPath):
mxd = arcpy.mapping.MapDocument(fullPath)
print "MXD: " + fileName
arcpy.env.workspace = fullPath
mxd.replaceWorkspaces("", "NONE", r"Database Connections\pathtoSDE.sde","SDE_WORKSPACE")
mxd.save()
del mxd
else:
print "error! {0} failed to be replaced".format(fullPath)
print "+++successfully changed data sources+++"
... View more
06-22-2018
02:26 PM
|
1
|
0
|
2908
|
|
POST
|
Thanks Dan, I see what you mean now. To run the program, I was using a shortcut of the Pythonwin.exe out of the 10.4 folder, I believe. That's what I'm doing now out of the 10.5 folder. In short, using a separate install of Python to run scripts that call the arcpy module will give you problems.
... View more
06-20-2018
01:00 PM
|
0
|
0
|
11906
|
|
POST
|
Update: I uninstalled ArcMap 10.5.1 then reinstalled. Might not have been necessary but it made sure i started fresh. I also deleted any folders referring to older versions of ArcMap. This is where I then installed the version of PythonWin you pointed out: C:\Python27\ArcGIS10.5\Lib\site-packages The pywin32-223.win32-py2.7.exe version is compatible with Python IDLE 2.7.13, which is the version that is installed with ArcGIS 10.5.1. After the install the PythonWin application lives here: C:\Python27\ArcGIS10.5\Lib\site-packages\pythonwin\Pythonwin.exe I think before I was simply not installing it in the correct location.
... View more
06-20-2018
12:21 PM
|
0
|
2
|
11906
|
|
POST
|
Jimmy, Thanks for the info. Did you install in your ArcGIS 10.5 folder? I did download the win32-py27 version as ArcMap requires Python 2.7. It saved to my 10.5 folder: C:\Python27\ArcGIS10.5. I got this Setup message and then finished the install. I'm not sure what this message meant. I opened Pywin and tried a few of my scripts. There were errors for all of them. It won't even import the Arcpy module, or any module for that matter. It seems as though it doesn't know where to find them. I uninstalled then reinstalled Pywin, but the same message appears. Have any idea what I'm doing wrong?
... View more
06-19-2018
12:36 PM
|
0
|
0
|
11906
|
|
POST
|
Dan, Line 21 never printed. But, that's OK because every layer points to the same "BonnScott.sde" connection. I think this would have printed if the connection had a name different from BonnScott. Yes, line 23 did print. Sorry, I should have mentioned that the script ran fine with no errors.
... View more
06-14-2018
01:10 PM
|
0
|
2
|
2908
|
|
POST
|
We have a new database connection and all our MXDs have to be updated. I ran a script to update the layers on a bunch of MXDs. Then I opened a map, right clicked a layer, properties, then checked under the source tab to see if the changes took place. But, the layer was still referencing the old connection. Is there a snippet I could include in this script, or something else, that verifies that the layers have indeed been updated? There is a print statement in the script, but that just prints the name of the MXD. It doesn't really give concrete proof. import arcpy
import os
def find_and_replace(MXD_workspace, oldPath, newPath):
arcpy.env.workspace = MXD_workspace
path = arcpy.env.workspace
for root, dirs, files in os.walk(path):
for name in files:
if name.endswith(".mxd"):
mxd_name = name
fullpath = os.path.join(root,name)
print mxd_name
print fullpath
mxd = arcpy.mapping.MapDocument(fullpath)
for df in arcpy.mapping.ListDataFrames(mxd):
for flayer in arcpy.mapping.ListLayers(mxd, "*", df):
if flayer.isFeatureLayer or flayer.isRasterLayer:
try:
mxd.findAndReplaceWorkspacePaths(oldPath, newPath, False)
print "Repaired the path for " + name
except:
print(mxd_name + " cannot replace paths")
mxd.save()
del mxd
print "complete..."
if __name__ == '__main__':
find_and_replace(r"\\gisfile\GISmaps\AtlasMaps\ATLAS_MAPS_18\CountyBoard",
r"Database Connections\BonnScott.sde",
r"Database Connections\gisEddy.gissql.sde") #(path2MXDs, path2oldGDB, path2newGDB)
... View more
06-14-2018
12:17 PM
|
0
|
5
|
3113
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-25-2026 12:25 PM | |
| 1 | 05-04-2026 08:45 AM | |
| 1 | 04-20-2026 01:20 PM | |
| 1 | 07-24-2025 01:27 PM | |
| 1 | 11-13-2025 08:22 AM |
| Online Status |
Online
|
| Date Last Visited |
5 hours ago
|