0

I have polar ArcGIS map and want to display my own data on it. I will get data using AJAX REST queries to my server. As I understand, it isn't commonly used way to get data in ArcGIS, but presenting data in appropriate format for ArcGIS and loading it on ArcGIS server will be more difficult task and it may be not free.

I have the following code for my map:

require([
"esri/Map",
"esri/graphic",
"esri/symbols/SimpleMarkerSymbol",
"esri/views/MapView",
"esri/layers/TileLayer",
"esri/layers/FeatureLayer",
"esri/geometry/Point",
"dojo/domReady!"
],
function (Map, MapView, TileLayer, FeatureLayer, Graphic, Point, SimpleMarkerSymbol) {
    var map = new Map({
        layers: [
            new TileLayer({
                url: "https://gis.ngdc.noaa.gov/arcgis/rest/services/arctic_ps/arctic_basemap/MapServer"
            })
        ]
    });

    var point = {
        type: "point",
        longitude: 77.962148,
        latitude: 24.451656
    };
    var markerSymbol = {
        type: "simple-marker",
        color: [226, 119, 40]
    };

    map.on("load", function () {
        map.graphics.add(new Graphic({
            geometry: point,
            symbol: markerSymbol
        }));
    });


    var viewSpatialReference = 3995;
    var centerPoint = {
        x: 1000000,
        y: -1000000,
        spatialReference: viewSpatialReference
    };

    var viewOptions = {
        container: "map",
        map: map,
        viewingMode: "local",
        spatialReference: viewSpatialReference,
        scale: 12000000,
        center: centerPoint
    };

    var view = new MapView(viewOptions);
});

When I load map, I get error in console:

[esri.core.Accessor] Accessor#set Assigning an instance of 'esri.symbols.SimpleMarkerSymbol' which is not a subclass of 'esri.layers.Layer'

The strangest thing is Google doesn't find anything relative with this error, that make sense, only link to SimpleMarkerSymbol documentation and so on.

Hope someone is familiar with this problem. If there is another way to display markers with certain lat long, I can change my approach.

5

It's because your function arguments don't match up with your require modules. These must be in the same order!

require([
"esri/Map",
"esri/views/MapView",
"esri/layers/TileLayer",
"esri/layers/FeatureLayer",
"esri/graphic",
"esri/geometry/Point",
"esri/symbols/SimpleMarkerSymbol",
"dojo/domReady!"
],
function (Map, MapView, TileLayer, FeatureLayer, Graphic, Point, SimpleMarkerSymbol) {

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.