closest facility

12-20-2019 12:45 PM
Frequent Contributor

I am looking at the example and having a hard time trying to figure out how to replace the hospital locations defined in the facilitiesOverlay, with features that I would have in a RestEndpoint.  Say my hospitals were in a RestEndPoint....

GraphicsOverlay {

        id: facilitiesOverlay

I think this would have to be manipulated as well?  

    function createFacilities() {
        featureLayerFishing.featureTable.forEach(function(graphic) {
        // {
            var facility = ArcGISRuntimeEnvironment.createObject("Facility", {geometry: featureLayerFishing.geometry});

I should be able to place the FeatureLayer in the map as such correct?

I tried to modify the createFacilities function above but did no justice as I am not sure how to approach this...

Any thoughts?

        Map {
            BasemapStreets {}

            initialViewpoint: ViewpointCenter {
                Point {
                    x: -13041154
                    y: 3858170
                    spatialReference: SpatialReference { wkid: 3857 }
                targetScale: 1e5
            FeatureLayer {
                id: featureLayerFishing

                ServiceFeatureTable {
                    id: featureTable0
                    url: ""
            onLoadStatusChanged: {

0 Kudos
2 Replies
Esri Regular Contributor

Based on the FeatureTable doc, FeatureTable QML Type | ArcGIS for Developers, I don't think you can call forEach out of the QML type. 

The key here is to query the features from the FeatureTable, then add them (the geometry) to the facilities array. 

0 Kudos
Frequent Contributor

alright will look into that....thanks Erwin

0 Kudos