Layer display problems

3278
4
Jump to solution
06-11-2016 11:34 AM
Arnt_OddvarPedersen
New Contributor

Hello!

I'm making an app that's using some of the ArcGIS/ESRI features and the JavaScript API.

I've managed to create a new Web Map where I added my own Map Notes layer.  On that layer I marked up my content using the Area and Text tool. I applied my styles to them so they're not all the same color and saved the layer/map.

After reading for a bit, I found out that to get them displayed on my base map I needed to import the layer service and apply it to my map view in JS.

require(["esri/Map",
         "esri/views/MapView",
         "esri/layers/FeatureLayer",
         "dojo/domReady!"
        ], function (Map, MapView, FeatureLayer) {
    var featureLayer = new FeatureLayer({
        url: "http://services.arcgis.com/MyID/arcgis/rest/services/MyLayerName/FeatureServer/3",
        outFields: ['*']
    });
    var map = new Map({
        basemap: "topo",
        layers: [featureLayer]
    });
    var view = new MapView({
        container: "areaMap",
        map: map,
        zoom: 13,
        center: [13.1835075, 65.8429693]
    });
});

This thing works really well however once I published the layer I had created it seems to have lost all the styling and settings I set to the different Area shapes, not to mention that the text fields I had up with them are gone. What have I done wrong here?

Alternatively, I read through the 4.0 Documentation that you can directly load a WebMap as well through Javascript but when I try to load my custom map with my Feature Layer attached to it, the layers seem to not load at all.

I'd appreciate any help on this as I've been hitting my head against the wall since Thursday trying to fix this now.

Thank you!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Arnt,

  The difference is like I said earlier the layer and all of it's sub layers are rendered on the server (not the client) thus it uses the full capabilities of ArcGIS server (i.e. advanced cartography, labeling, etc). Yes it is as simple as the sample you linked. Give it a try.

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Arnt,

  Do you have a specific need to use FeatureLayer and not just use MapImageLayer? When you use FeatureLayer you will end up losing may things you have setup, as they will have to be manually setup. If you use MapImageLayer then the layer will be rendered on the server and will maintain the features you are losing.

0 Kudos
Arnt_OddvarPedersen
New Contributor

Hello Robert Scheitlin, GISP​!

That's something I've not thought about at all. How much different is it?

Currently all I need extra is the PopupTemplate system that lets me make that nice tooltip (which also contains a generated link for each river area when clicked that brings people to the last view.)  so as long as it supports doing something like this I'm all for it.

How do I make it a MapImageLayer? Simply just load the WebMap/Scene with the layer in it like this example?
MapImageLayer | ArcGIS API for JavaScript 4.0

Cheers,

Arnt

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Arnt,

  The difference is like I said earlier the layer and all of it's sub layers are rendered on the server (not the client) thus it uses the full capabilities of ArcGIS server (i.e. advanced cartography, labeling, etc). Yes it is as simple as the sample you linked. Give it a try.

Arnt_OddvarPedersen
New Contributor

That worked out just brilliantly. Thank you so much!

0 Kudos