BLOG
|
I thought I showed you how to add a related tables data in the previous code? What kind of related data are you looking to add to the popup?
... View more
11-09-2022
07:57 AM
|
1
|
0
|
3119
|
POST
|
I guess the key is figuring out at what level you need the JSON info, like looking for the webmap info might be just adding 'webmap?f=pjson' to the end of a known content item, like: https://wvdep.maps.arcgis.com/sharing/rest/content/items/b062fc8f8d6e4ec1a44ab466829a1494/webmap?f=pjson While looking at the data would mean adding 'data?f=pjson' to the end of the item: https://wvdep.maps.arcgis.com/sharing/rest/content/items/b062fc8f8d6e4ec1a44ab466829a1494/data?f=pjson
... View more
11-01-2022
02:02 PM
|
0
|
1
|
825
|
POST
|
Not sure what you are missing. If you are looking for Map information you can see that by looking at the map REST service such as: https://tagis.dep.wv.gov/arcgis/rest/services/Hosted/Apples_and_Solar/MapServer Or as JSON: https://tagis.dep.wv.gov/arcgis/rest/services/Hosted/Apples_and_Solar/MapServer?f=pjson A lot of those properties, like 'bookmarks' or 'widgets' almost seem like attributes for an application, even though it does say they are available for the Webmap. Not sure if that's viewable like this or not.
... View more
11-01-2022
01:46 PM
|
0
|
0
|
829
|
POST
|
Portal is like your own personal ArcGIS Online. You can create layers that are accessible using their defined REST endpoint. The 'JSON web map specification' is accessible by entering the feature layer's URL, with our without the ArcGIS Javascript API. Such as https://services5.arcgis.com/4LKAHwqnBooVDUlX/arcgis/rest/services/PARKS_Historic_Old_Growth_Trees/FeatureServer/0 . The only difference between this (ArcGIS Online) and Portal would be the server information such as https://services5.arcgis.com would be something else like https://local.server.com. ArcGIS Javascript API is a Javascript library located through a URL that provides functionality (through Javascript) to access ArcGIS Online and Portal REST endpoints (and other things). But the 'JSON' representation of the data being access is available through the layers URL (REST URL). The only thing needed to write a publicly accessible ArcGIS Javascript API web application that access Portal data is to have the web app housed on a publicly exposed server running IIS or Apache, and the Portal publicly (outside the agency's firewall) available with data layers that are shared to everyone. Hope this makes sense and is answering your question.
... View more
11-01-2022
11:04 AM
|
0
|
1
|
843
|
POST
|
Since the Editor widget is creating your feature you can't pass any attributes at creation, you need to set up an event monitor for the layer being edited, and then when that occurs create the attribute for the feature and save it using Apply Edits. Maybe something like this: aLayer.on("apply-edits", function (results) {
if (results.edits.addFeatures) {
var newObjectId = results.addFeatureResults[0]["objectId"];
console.log("Added new feature with objectID: ", newObjectId);
var edit = [{"id" : 0,
"updates": [
"attributes": {
"OBJECTID": newObjectId,
"datetime": 1272210710000,
"Somefield": "This is an updated value"
}
]
}]
var promise = aLayer.applyEdits(edit);
console.log(promise);
}
})
... View more
10-31-2022
08:59 AM
|
0
|
0
|
210
|
POST
|
Take the coordinates, create a new point, and then add it to the layer using the applyEdits() function.
... View more
10-26-2022
08:22 AM
|
1
|
0
|
408
|
POST
|
The Editor widget provides this function out of the box, and there are many examples. You can build the functionality yourself by first creating a point graphic under the view.hitTest() and then either immediately adding the point to a layer through its applyEdits() function, or building some kind of interface (menu, button) to have the user accept this new point and then push it through applyEdits(). I have one application where I use the Editor to edit only existing features, and if the user hits a button before picking a point on the screen, the point is generated and pushed to the layer, something like: view.on("immediate-click", (event) => {
// Listen for when the user clicks on the view
view.hitTest(event).then((response) => {
let curPt = view.toMap(response.screenPoint);
let graphics = response.results.filter(function (result) {
// check if the graphic belongs to the layer of interest
return result.graphic.layer === busStopLayer;
});
if (highlight) {
highlight.remove();
highlight = null;
}
if (getStreetView) {
... Can do other things if not wanting to create a new point
else if (graphics.length > 0) {
... the user selected an existing graphic, handle it
else if (addStopReady && juris != "None") {
// Clear current graphics layer (specified upon initialization)
if (gLayer) {
gLayer.removeAll();
}
// Generate new stop ID
...
// Populate attributes for new point
let attributes = {};
attributes["StopID"] = newStopID;
attributes["Juris"] = juris;
attributes["Status"] = "Requested";
attributes["Long"] = curPt.longitude;
attributes["Lat"] = curPt.latitude;
// Build new point graphic
let newPoint = new Graphic({
attributes: attributes,
geometry: curPt
});
var newObjectId = 0;
theLayer.applyEdits({
addFeatures: [newPoint]
}).then((editResult) => {
console.log(editResult);
if (editResult.addFeatureResults.length > 0) {
// New point was successfully added, get the new objectID
newObjectId = editResult.addFeatureResults[0]["objectId"];
console.log("Added new bus stop with objectID: ", newObjectId);
theLayer.refresh(); //Esri says this is not needed, but it seems to help.
})
.catch(function (error) {
console.error("New bus stop ID Error: " + error);
});
}
});
});
... View more
10-26-2022
08:04 AM
|
0
|
1
|
412
|
POST
|
Yes, I started looking at the Github site (https://github.com/Esri/arcgis-experience-builder-sdk-resources ) for extending the widgets and I realize it's only an option when you bring the Experience Builder code into one of your servers (https://developers.arcgis.com/experience-builder/guide/install-guide/ ), so it's not like you can customize what's on ArcGIS Online directly with the JS API code you have. Once it's loaded on your own server you can customize Experience Builder to your heart's content, but at that point the JS API may, or may not, be a better option. Depends on what you want to do I guess, and how much control you want in customizing widgets and their interactions. I haven't customized Experience Builder at all, yet, so I'm not a good one to ask, but I do want to figure that approach out more myself.
... View more
10-18-2022
11:31 AM
|
1
|
0
|
1384
|
BLOG
|
We started going even farther back and setting the desired popups in ArcGIS Pro. That way every time that we updated a featureclass Online the popup information would come forward and reset the ArcGIS Online one. The only issue is that the Expressions don't come over so if you have those in Pro you need to recreate them Online (as they get lost when you do an update of Online data), although having them documented in Pro seems safer. I wish the popup customization capacity was the same across the board, from Pro to Online, for consistancy purposes.
... View more
10-18-2022
11:15 AM
|
8
|
0
|
5900
|
POST
|
ArcGIS Javascript API is different than Experience Builder (EB). For EB, you have prebuilt widgets (web pages and widgets that reside on them) that you can select from to create custom interfaces to work with Esri data. It's easier to build things than the JS API but you are still limited in how the widgets work. You can create customized widgets and add them to EB and I saw a Github site awhile back that showed how to extend some Esri widgets for EB. For the JS API, you need to build an application which can be just Javascript and HTML, or maybe with C#, Javascript and HTML, or similar. You could do this using Notepad, but that's very difficult. Pretty much everyone uses an Integrated Development Environment (IDE) like Visual Studio to write, compile, and publish the code. In order to have the final site 'published' you need to push it out to an internet service engine, such as Microsoft's IIS or Apache. This needs to be installed on a server that has access to the internet and you can do this in house or buy space on one already in the cloud. EB has the ability to publish the final product to ArcGIS Online so it doesn't need IIS. An ArcGIS Javascript API application can be built to access data in ArcGIS Online, but it can't reside in ArcGIS Online. The closest thing to building something (custom) and then publishing it to ArcGIS Online is Experience Builder. Bottom line, you can't use the code you linked to inside of EB, but you might be able to customize some of the widgets in EB based on the code you find. Need to know Typescript for that.
... View more
10-18-2022
07:48 AM
|
3
|
2
|
1411
|
BLOG
|
I kind of like the new Map Viewer for relationships. I was trying to figure out how to cycle through all related records for 1 bus stop and attach that to the popup in the original Map Viewer. Using an Expression this is possible, but the resulting HTML couldn't be read by the Custom Popup. I also tried to create a list, but then how can you work with that in the Custom Popup as it only allows straight HTML and inline CSS. But using the new Map Viewer's Arcade section for Popups, I was able to attach to the relationship, select all of the related records for the current point, build an HTML table and present it in the popup. Definitely a much better situation. var tblRidership = FeatureSetByRelationshipName($feature,"GISBusRidership",
['stopID', 'FiscalYear','groupVal', 'Total_Weekday_Fares',
'Avg_Weekday_Fares', 'Total_Friday_Fares','Avg_Friday_Fares',
'Total_Saturday_Fares','Avg_Saturday_Fares',
'Total_Sunday_Fares','Avg_Sunday_Fares',
'RoutesServed'
],false
)
// Sort related ridership by oldest to newest
var tblRidershipSorted = OrderBy(tblRidership, 'FiscalYear, groupVal ASC')
// Build the popup string by iterating through all related features
var strPop = '<p style="font-size: 1.6em; color: #0e4f49;">Ridership for bus stop ';
strPop += '<br />' + $feature.Location + '</p>';
strPop += '<table border="1" style="width: 191px; color: #ffffff; background-color: #177c72; border-color: #ffffff;"><tbody>' + NL
strPop += '<tr><td style="width: 50px; background-color: #12635b; text-align: center;"><strong>Year</strong></td>';
strPop += '<td style="width: 24px; background-color: #12635b; text-align: center;"><strong>Quarter</strong></td>';
strPop += '<td style="width: 50px; background-color: #12635b; text-align: center;"><strong>Avg Weekday</strong></td>';
strPop += '<td style="width: 50px; background-color: #12635b; text-align: center;"><strong>Avg Friday</strong></td>';
strPop += '<td style="width: 50px; background-color: #12635b; text-align: center;"><strong>Avg Saturday</strong></td>';
strPop += '<td style="width: 50px; background-color: #12635b; text-align: center;"><strong>Avg Sunday</strong></td></tr>';
for (var f in tblRidershipSorted) {
strPop += '<tr><td style="width: 71px; background-color: #12635b; text-align: center; padding: 4px;"><strong>' + f.FiscalYear + '</strong></td>';
strPop += '<td style="width: 24px; background-color: #12635b; text-align: center;"><strong>' + f.groupVal + '</strong></td>';
strPop += '<td style="width: 50px; background-color: #12635b; text-align: center;"><strong>' +
DefaultValue(f.Avg_Weekday_Fares, 'no data') + '</strong></td>';
strPop += '<td style="width: 50px; background-color: #12635b; text-align: center;"><strong>' +
DefaultValue(f.Avg_Friday_Fares, 'no data') + '</strong></td>';
strPop += '<td style="width: 50px; background-color: #12635b; text-align: center;"><strong>' +
DefaultValue(f.Avg_Saturday_Fares, 'no data') + '</strong></td>';
strPop += '<td style="width: 50px; background-color: #12635b; text-align: center;"><strong>' +
DefaultValue(f.Avg_Sunday_Fares, 'no data') + '</strong></td></tr>';
}
strPop += '</tbody></table>';
return {
"type": "text",
"text": strPop
} And performance seems pretty good. Here's a link if you want to try it: https://valleymetro.maps.arcgis.com/apps/mapviewer/index.html?webmap=8115b6d7a99540e5b4620be69f951ccd
... View more
10-13-2022
09:26 AM
|
13
|
0
|
7244
|
POST
|
Is this resolved by JCarlson's response? I think the EXTRACT function will give you what you what. If I query an Esri site for a Date and a Month range I get data results, as in this example: https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/LA_County_Parcels/FeatureServer/0/query?where=SpatialChangeDate+%3E+%271%2F1%2F2020%27+AND+EXTRACT%28MONTH+FROM+SpatialChangeDate%29+IN+%282%2C3%29&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&resultType=none&distance=0.0&units=esriSRUnit_Meter&relationParam=&returnGeodetic=false&outFields=SpatialChangeDate&returnGeometry=false&returnCentroid=false&featureEncoding=esriDefault&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=&defaultSR=&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnQueryGeometry=false&returnDistinctValues=false&cacheHint=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&having=&resultOffset=&resultRecordCount=&returnZ=false&returnM=false&returnExceededLimitFeatures=true&quantizationParameters=&sqlFormat=none&f=html&token= Which uses the SQL: SpatialChangeDate > '1/1/2020' AND EXTRACT(MONTH FROM SpatialChangeDate) IN (2,3)
... View more
10-03-2022
08:48 AM
|
0
|
0
|
648
|
POST
|
Not sure why the highlight problem is occuring if your code didn't set it, but the highlight is attached to the layerview, maybe if after you close the popup you set the view.layerview.highlight.remove()?
... View more
09-26-2022
08:02 AM
|
0
|
0
|
317
|
POST
|
And check out this latest post from UndralBatsukh. Seems you can change the color properties on the Highlight option. https://community.esri.com/t5/arcgis-api-for-javascript-questions/hittest-different-highlight-based-on-feature-value/m-p/1215504
... View more
09-23-2022
09:12 AM
|
0
|
0
|
678
|
POST
|
You don't really say what the 'stops' are for, but when I hear that I think of bus stops as I work for a transit agency. I have built an app to allow our member agencies to edit bus stops, including adding new ones. We are in the process of determining if we can get to where this can also be an editing of the bus stop sequencing, as that becomes complicated with other factors, namely: What route is this bus stop associated with Are there multiple routes associated with this bus stop Are all of the bus stops associated with this route viable (active, not test/temporary, etc) And the final difficulty is making sure the stops follow a logical, networked path as just determining if it was the next stop based on distance does not always work due to complexities in the route or obstacles such as 1 way streets/ramps, water ways, etc. I have often thought this would be best as a Python script, or maybe SQL Server stored procedure to run through all of the stops and determine how best to sequence them. Something that could be run on a nightly basis or maybe on demand. Having them as part of a Javascript app could be interesting though. Not sure how your data is structured, but ours has related route information (and amenities) because each bus stop can have multiple routes, and they change often whereas the bus stops not so much. If I designed something to work for the Javascript side it would have to incorporate this relation to get started, as you really need to pull out just the stop points for 1 route at a time. If you are looking at stops for something else you maybe be able to just all of the points available as one route. That would definitely uncomplicate things.
... View more
09-22-2022
09:57 AM
|
1
|
0
|
180
|
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
|