POST
|
I'm not sure what you are going to use a 'Near Me' test with an address for. If your users are entering an address, then maybe you should look at the Search Widget (links to examples are on that page). If you want them to select a polygon based on the value of one of it's attributes, maybe you want to look at something like this . And if you want to have them select features based on a user supplied boundary then maybe you want to look at this example.
... View more
12-02-2022
09:23 AM
|
0
|
2
|
647
|
POST
|
You could get an account at CodePen and save your work there. Then you could provide others with that to test things. But that wouldn't be your production version. To do that you would need to house an Internet Information Server (IIS) from Microsoft, or an Apache server and expose it outside of your firewall, or purchase space on a server already on the internet such as through Servermania or GoDaddy, or utilize cloud services such as Amazon Web Services to have an internet server built in the cloud. Either way, you need a web application server on the internet that you can upload your web site to. You can build applications that utilize GIS data on ArcGIS Online, or ArcGIS Portal that are shared through a firewall, but either way you need to have access to a server running IIS or Apache, and that is exposed to the internet. If you have a license to ArcGIS Enterprise (ArcGIS Server, ArcGIS Portal, and ?), you can build web sites, and expose them through a server running IIS (or Apache) internal to your organization, but to get them on the internet any internal server needs to be open to the internet for it's web site content to be viewable outside of your org. If you have access to ArcGIS Online to build your data, you just need to get the web site you are building published on an external/external facing server to provide this outside of your organization.
... View more
11-30-2022
01:04 PM
|
0
|
0
|
257
|
POST
|
If you had the features in the same map, you could search the View's onclick for any graphics related to one layer, and if they exist, only show the popup for that layer (by only gathering up the features for that layer). Then, if features weren't found for that layer, you could use those for that feature's popup (by only passing the features for that layer). This is how I'd approach it: <html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Intro to FeatureLayer | Sample | ArcGIS API for JavaScript 4.25</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.25/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.25/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/PopupTemplate"], (Map, MapView, FeatureLayer, PopupTemplate) => {
const map = new Map({
basemap: "hybrid"
});
const view = new MapView({
container: "viewDiv",
map: map,
extent: {
// autocasts as new Extent()
xmin: -9177500,
ymin: 4247200,
xmax: -9176900,
ymax: 4247600,
spatialReference: 102100
}
});
/********************
* Add feature layer
********************/
// Carbon storage of trees in Warren Wilson College.
const treeLayer = new FeatureLayer({
url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0",
id: "treeLayer",
popupTemplate: {
title: "Trees Layer",
content: [
{ type: "fields", // FieldsContentElement
fieldInfos: [
{ fieldName: "Tree_ID"},
{ fieldName: "Collected"}
]
}]
}
});
const dTileLayer = new FeatureLayer({
url: "https://services.arcgis.com/QCty4ZXRXx9qyVVL/arcgis/rest/services/Download_Tiles_Ashville_NC/FeatureServer/0",
id: "dTileLayer",
popupTemplate: {
title: "Download Tiles Layer",
content: [
{ type: "fields", // FieldsContentElement
fieldInfos: [
{ fieldName: "Name"},
{ fieldName: "Path"}
]
}]
}
});
map.addMany([treeLayer, dTileLayer]);
view.popup.autoOpenEnabled = false;
view.on("immediate-click", (event) => {
view.hitTest(event).then((response) => {
let treeGraphics = response.results.filter(function (result) {
return result.graphic.layer === treeLayer;
});
let dTileGraphics = response.results.filter(function (result) {
return result.graphic.layer === dTileLayer;
});
var features2Use = [];
if (treeGraphics.length > 0) {
for (var i = 0; i < treeGraphics.length; i++) {
features2Use.push(treeGraphics[i].graphic);
}
}
else if (dTileGraphics.length > 0) {
for (var i = 0; i < dTileGraphics.length; i++) {
features2Use.push(dTileGraphics[i].graphic);
}
}
view.popup.open({
features: features2Use
});
});
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
11-30-2022
10:49 AM
|
1
|
1
|
463
|
POST
|
The Expand widget Content section describes that it can handle a Node, String, or Widget. So you could add text like this: <html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<title>
Intro to FeatureLayer plus Expand Widget | ArcGIS API for JavaScript 4.25
</title>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.25/esri/themes/light/main.css"
/>
<script src="https://js.arcgis.com/4.25/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require(["esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer","esri/widgets/Expand"], (
Map,
MapView,
FeatureLayer,
Expand
) => {
const map = new Map({
basemap: "hybrid"
});
const view = new MapView({
container: "viewDiv",
map: map,
extent: {
// autocasts as new Extent()
xmin: -9177811,
ymin: 4247000,
xmax: -9176791,
ymax: 4247784,
spatialReference: 102100
}
});
// ** Add feature layer **
// Carbon storage of trees in Warren Wilson College.
const featureLayer = new FeatureLayer({
url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0"
});
map.add(featureLayer);
// ** Add Expand Widget **
const bgExpand = new Expand({
view: view,
content: "<p style='background-color:white; width: 150px;''>This is a string to display</p>"
});
view.whenLayerView(featureLayer).then(function () {
view.ui.add(bgExpand, "top-right");
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
11-30-2022
09:35 AM
|
1
|
1
|
427
|
POST
|
Ah, so the key was adding the popupTemplate info for the related table. I think.
... View more
11-30-2022
08:42 AM
|
0
|
0
|
746
|
POST
|
I think it's working. I just added our bus stop layer and associated routes into your code and it works. <html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Browse related records in a popup - 4.25</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.25/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.25/"></script>
<script>
require([
"esri/Map",
"esri/layers/FeatureLayer",
"esri/views/MapView",
"esri/widgets/Legend",
"esri/widgets/Expand",
"esri/core/reactiveUtils"
], (Map, FeatureLayer, MapView, Legend, Expand, reactiveUtils) => {
// Create the map.
const map = new Map({
basemap: "gray-vector"
});
// Create the MapView.
const view = new MapView({
container: "viewDiv",
map: map,
center: {
x:-112.0732, y: 33.4512
},
scale: 1000,
popup: {
defaultPopupTemplateEnabled: true,
// Dock the popup in the top right corner.
dockEnabled: true,
dockOptions: {
breakpoint: false,
position: "top-right"
}
}
});
const busStops = new FeatureLayer({url: 'https://services2.arcgis.com/2t1927381mhTgWNC/ArcGIS/rest/services/ValleyMetroBusStops/FeatureServer/0', popupTemplate: {
content: [
{
type: "relationship",
relationshipId: 0,
description:
"Routes associated with this bus stop",
title: "Bus Stop Routes",
// Order list of related records by the 'UNIT' field in ascending order.
orderByFields: {
field: "Route",
order: "asc"
}
}
]
}});
map.add(busStops);
const Routes = new FeatureLayer({url: 'https://services2.arcgis.com/2t1927381mhTgWNC/ArcGIS/rest/services/ValleyMetroBusStops/FeatureServer/3'});
map.tables.add(Routes);
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html> I'm not sure if the problem is hosted vs non-hosted, or something else. The relationship seems strange in that you have a relationship 0 (condos) for the top layer (property), and then 4 relationships under that (3 to the first relationship (books, addresses, and photos), and 1 back to the top layer (property). Not sure if this matters but just pointing out differences between my layer with a relationship that works in your code. You can access the related fields directly using something like this, so I'm thinking it's not an issue with being non-hosted: <html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Browse related records in a popup - 4.25</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.25/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.25/"></script>
<script>
require([
"esri/Map",
"esri/layers/FeatureLayer",
"esri/views/MapView",
"esri/widgets/Legend",
"esri/widgets/Expand",
"esri/core/reactiveUtils"
], (Map, FeatureLayer, MapView, Legend, Expand, reactiveUtils) => {
// Create the map.
const map = new Map({
basemap: "gray-vector"
});
// Create the MapView.
const view = new MapView({
container: "viewDiv",
map: map,
center: {
x:-78.643865, y: 35.779382
},
scale: 1000,
popup: {
defaultPopupTemplateEnabled: true,
// Dock the popup in the top right corner.
dockEnabled: true,
dockOptions: {
breakpoint: false,
position: "top-right"
}
}
});
const property = new FeatureLayer({url: 'https://maps.raleighnc.gov/arcgis/rest/services/Property/Property/FeatureServer/0', popupTemplate: {
content: [
{
type: "fields",
fieldInfos: [
{ fieldName: "PIN_NUM", label: "PIN"},
{ fieldName: "SITE_ADDRESS", label: "Address"},
{ fieldName: "TOTSTRUCTS", label: "# Structures"},
{ fieldName: "relationships/0/PIN_EXT", label: "PIN Ext"},
{fieldName: "relationships/0/PIN_NUM", label: "PIN Number"}
]
},
{
type: "relationship",
relationshipId: 0,
description:
"Condo units associated with this property",
title: "Condo Units",
// Order list of related records by the 'UNIT' field in ascending order.
orderByFields: {
field: "PIN_EXT",
order: "asc"
}
}
]
}});
map.add(property);
const condos = new FeatureLayer({url: 'https://maps.raleighnc.gov/arcgis/rest/services/Property/Property/FeatureServer/1'});
map.tables.add(condos);
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
11-30-2022
07:23 AM
|
0
|
1
|
759
|
IDEA
|
We have light rail ridership points that get generated when the cars stop at a station and people either get off (alight) or get on (board). This is supposed to occur next to a station, but due to irregularities in GPS locating they sometimes occur at a distance away from the station. In order to identify which station the records belong to, I developed a SQL Server procedure that (using SQL Server Spatial tools) determines the nearest station based on distance. This works pretty well until you get to some stations that are really close, or where the Eastbound/Westbound lines actually share the same station. 50th Street Station, East and West Bound So we've come up with the idea that we should build polygons around the light rail stations to allow for points to be defined to the correct, or at least 'most' correct light rail station based on them being in a polygon, vs just the closest station. To build the polygons I was going to buffer the 2 light rail lines (Eastbound and Westbound) the outside by say 1/2 of a mile, and then determine the centerline between the 2 lines for something that would divide the 2 halves evenly. I tried using the Merge Divided Roads in Pro. I added a field called 'Class' to the light rail routes and calculated them all to be '1'. Then I ran Merge Divided Roads and it returned the same routes that went into the command. arcpy.cartography.MergeDividedRoads("LightRailLine", "Class", "1000 Feet", r"C:\Documents_Me\Projects\Ridership\MyProject1\MyProject1.gdb\LightRailCenter", None, None, None) Not sure how to use this command I kept looking and came across the CollapseDualLinesToCenterline command for ArcMap. Not finding an equivalent for Pro, I fired up the ArcMap I still have on my desktop and within a minute I had the centerline I was looking for: Not sure why it does some of the squiggles it does, as the existing routes don't seem to deviate that much, but at least it's a start in getting something to work with. Now I can get on with creating polygons around each station. I can see a Collapse2LinesTo1Centerline command in Pro as being helpful for this specific situation, but also others such as showing the center of a river based on its 2 banks, or merging 2 or more roads (different LIDAR/GPS tracks?) into 1 centerline, or finding the line between 2 distant parcels. When I was with the Dept. of Transportation, we had an awesome developer, Tom Tyndall that came up with a way to show multiple fence surveys next to roads by buffering each survey from the road (or last survey) and creating offset lines with survey attributes. I've often wondered if something similar could be used to generate transit lines within an urban area, ones that were offset to show better, but didn't overlap other route lines. Maybe a centerline generation tool would help in that instance as well. Thanks for listening. I have 2 lines denoting the path of light rail trains through an urban area. I am interested in segmenti
... View more
11-21-2022
10:06 AM
|
0
|
2
|
1349
|
POST
|
Thanks Dan. I had messed around with Merge Divided Roads for awhile before I decided it wasn't worth putting that much effort into trying to make my 2 light rail lines look like roads in order for it to work. Since I still had ArcMap loaded it was much easier to get CollapseDualLinesToCenterline to work. Yeah, maybe I'm being lazy but I will still use the ArcMap way until Esri either puts the same functionality in Pro or I HAVE to do something different.
... View more
11-21-2022
08:46 AM
|
0
|
0
|
422
|
POST
|
Why isn't there something like CollapseDualLinesToCenterline in Pro. Now I've found another reason why I just can't live without Desktop still.
... View more
11-18-2022
04:18 PM
|
0
|
5
|
497
|
POST
|
It's hard to understand where your URL references are coming from, but it almost seems as if you have access to them before they are needed. You should just be able to use the built in Javascript functions toLowerCase() and toUpperCase(), like: let text = "{ABK}";
let lText = text.toLowerCase();
let uText = text.toUpperCase();
...
sourceURL: "https://www.xx.x/xx/xx/foto_" + lText + ".jpg"
...
sourceURL: "https://www.yy.y/y/yyy/label/" + uText But I'm guessing there's something you aren't telling us that makes this harder than this.
... View more
11-10-2022
07:59 AM
|
0
|
0
|
259
|
POST
|
Esri has all sorts of examples for pulling in data from a REST web service, this one talks about working with styling: https://developers.arcgis.com/javascript/latest/style-a-feature-layer/
... View more
11-10-2022
07:48 AM
|
0
|
0
|
187
|
IDEA
|
Thanks, I didn't scroll that far thinking it was just field information.
... View more
11-10-2022
07:43 AM
|
0
|
0
|
337
|
IDEA
|
In the legacy Map Viewer you can right click on a column to get statistics. This needs to be added to the new Map Viewer.
... View more
11-09-2022
11:57 AM
|
0
|
2
|
390
|
IDEA
|
In the legacy Map Viewer there is a Filter option that stays with the layer like the Definition Query does in Pro/Desktop, but in the new Map Viewer if you click away from the right hand screen the filter turns off. Would like to have the ability to set this to stay on during all interactions (checkbox or something?).
... View more
11-09-2022
09:29 AM
|
0
|
3
|
397
|
Title | Kudos | Posted |
---|---|---|
1 | 02-28-2024 01:40 PM | |
2 | 02-27-2024 01:13 PM | |
1 | 10-18-2022 11:31 AM | |
1 | 06-23-2023 09:13 AM | |
2 | 06-19-2023 09:05 AM |
Online Status |
Offline
|
Date Last Visited |
03-11-2024
10:48 PM
|