AnsweredAssumed Answered

Convert to Map Service from Web Map

Question asked by jay.kapalczynski on Sep 10, 2018
Latest reply on Sep 11, 2018 by rscheitlin

Referencing this example....trying to replace the web map with a rest end point

Right now not concerned with the map click function more so getting the web map converted over to my Rest Endpoint


javascript - Finding the closest facility in a feature layer from a webmap - Geographic Information Systems Stack Exchan… 


If I am way off please let me know.  


WHAT I AM AFTER:  I want to click on the map, get the XY, and use this to select and query the nearest point feature and return this to a grid of some sort.  



How to convert from Web Map to Map Service

Can I use a geometry service that I spin up on my server?

Do I need other extensions?


      var FCBoatRamps = new FeatureLayer("https://xxx/arcgis/rest/services/Projects/Locations/FeatureServer/1", {
        id: "idBoatRamp",
        outFields: ["*"],
          visible: true
    var lay = map.getLayer("idBoatRamp");
    var facilities = new FeatureSet();
     //facilities.features =;
     // require the dojo/_base/array module, named arrayUtils here
     arrayUtils.forEach(, function(g){
       facilities.features.push(new Graphic(g.geometry));

    var params = new ClosestFacilityParameters();
    params.travelMode = 5;
    params.facilities = facilities;
    params.returnIncidents = true;
    params.returnRoutes = true;
    params.returnDirections = true;
    params.outSpatialReference = map.spatialReference;

    map.on('click', function(evt) {
        var inPoint = new Point(evt.mapPoint.x, evt.mapPoint.y, map.spatialReference);
        var location = new Graphic(inPoint);

        var incidents = new FeatureSet();
        incidents.features = [location];
        params.incidents = incidents;

        closestFacilityTask = new ClosestFacilityTask("");

        closestFacilityTask.solve(params, function(solveResult){