2

First of all, going to this url for the geometry service referenced in the documentation shows it's been deactivated so I instead chose this url - both with /GeometryServer and /GeometryServer/buffer.

I suspect it has something to do with the spatial reference of my geometry or buffer param but I've used different GCS and PCS with the same result.

require(["esri/map",
     "esri/SpatialReference",
     "esri/geometry/Point",
     "esri/symbols/SimpleMarkerSymbol",
     "esri/symbols/SimpleLineSymbol",
     "esri/graphic",
     "esri/Color",
     "esri/tasks/BufferParameters",
     "esri/tasks/GeometryService"], 
function(Map, SpatialReference, Point, SimpleMarkerSymbol, SimpleLineSymbol, Graphic, Color, BufferParameters, GeometryService) {
var map = new Map("map", {
    basemap: "streets",
    center: [-97.744483, 30.272705], 
    zoom: 15
});
//Locate By Lat/Long
document.getElementById("btnLocate").addEventListener("click", function() {
    var latitude = Number(document.getElementById("latitude").value);
    var longitude = Number(document.getElementById("longitude").value);
    var pointGCS = new esri.geometry.Point(longitude, latitude, new SpatialReference({ wkid: 4326 }));
        var pointWMS = esri.geometry.geographicToWebMercator(pointGCS);
        var crossHair = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CROSS, 12, 
            new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 2), new Color([255, 0, 0]));
        var centerpoint = new Graphic(pointWMS, crossHair);
//Set buffer parameters
    var params = new BufferParameters();
    params.bufferSpatialReference = new SpatialReference({ wkid: 32662 });
    params.outSpatialReference = new SpatialReference({ wkid: 32662 });
    params.unit = GeometryService.UNIT_STATUTE_MILE;
    params.distances = [0.25, 0.50, 1];
    params.geometries = [centerpoint];
    var geoService = new GeometryService("http://tasks.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer");
    geoService.buffer(params);
    map.centerAndZoom(pointWMS, 15);
    }); 
});

Error:

  • can you please clarify which line in your code snippet above causes that error? Is it geoService.buffer(params)? – Stephen Lead Aug 31 '17 at 22:53
  • It is the line: geoService.buffer(params); – cevondanady Aug 31 '17 at 22:54
  • can you put a breakpoint in your developer tools on that line, print the values of params at that point (including expanding all of the > arrows to show their component values), and add as a screenshot? Something like this – Stephen Lead Aug 31 '17 at 23:04
  • 1
    32662 isn't a valid WKID. What coordinate system are you trying to use? – mkennedy Aug 31 '17 at 23:44
  • I was originally using 4236 but the documentation used 32662 so I tried that. However I do see now that it's been deprecated, but using any wkid for the buffer params gives me the same result. – cevondanady Sep 1 '17 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.