Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor hupe13

    (@hupe13)

    It should be possible. Extensions for Leaflet Map has Leaflet-Providers included and therefore arcGIS.

    [leaflet-map fitbounds]
    [layerswitch providers=Esri.WorldStreetMap]

    (not tested).

    P.S. Or simpler: Configure in Leaflet Map settings Map Tile URL and Default Attribution like here (Plain JavaScript).

    • This reply was modified 1 year, 10 months ago by hupe13. Reason: P.S
    • This reply was modified 1 year, 10 months ago by hupe13.
    Thread Starter azbce

    (@azbce)

    I may need to elaborate a little more. What you are talking about is for basemaps.

    Here is a list of MapServers provided by the US Forest Service. In particular, I’m trying to use the data from these two arcGIS MapServers.

    https://apps.fs.usda.gov/arcx/rest/services/EDW/EDW_AerialFireRetardantAvoidanceAreas_01/MapServer

    https://apps.fs.usda.gov/arcx/rest/services/EDW/EDW_AerialFireRetardantHydrographicAvoidanceAreas_01/MapServer/2

    For a normal Leaflet Map, you would do something like this:

    <html>
      <head>
        <meta charset="utf-8" />
        <title>Display a feature layer snapshot</title>
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
        <link rel="stylesheet"  crossorigin="" />
        <script src="https://unpkg.com/[email protected]/dist/leaflet.js" crossorigin=""></script>
        <!-- Load Esri Leaflet from CDN -->
        <script src="https://unpkg.com/[email protected]/dist/esri-leaflet.js"></script>
        <!-- Load Esri Leaflet Vector from CDN -->
        <script src="https://unpkg.com/[email protected]/dist/esri-leaflet-vector.js" crossorigin=""></script>
        <style>
          html,
          body,
          #map {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
            font-family: Arial, Helvetica, sans-serif;
            font-size: 14px;
            color: #323232;
          }
        </style>
      </head>
      <body>
        <div id="map"></div>
        <script>
          const apiKey = "API_KEY";
    
          const map = L.map("map").setView([33.54, -112.02], 7);
    
          L.esri.Vector.vectorBasemapLayer("ArcGIS:ColoredPencil", {
            apikey: apiKey
          }).addTo(map);
    
               L.esri
            .dynamicMapLayer({
              url: "https://apps.fs.usda.gov/arcx/rest/services/EDW/EDW_AerialFireRetardantAvoidanceAreas_01/MapServer",
              opacity: 0.7
            })
            .addTo(map);
                     L.esri
            .dynamicMapLayer({
              url: "https://apps.fs.usda.gov/arcx/rest/services/EDW/EDW_AerialFireRetardantHydrographicAvoidanceAreas_01/MapServer/2",
              opacity: 0.7
            })
            .addTo(map);
        </script>
      </body>
    </html>
    Plugin Contributor hupe13

    (@hupe13)

    Are you able to write some php and Javascript? You can see some examples “How to include …” here. To remove the default tile server adapt this code.

    map.eachLayer(function(layer) {
    	if( layer instanceof L.TileLayer ) {
    		map.removeLayer(layer);
    	}
    });
    Thread Starter azbce

    (@azbce)

    I have been playing with it, and can’t figure it out. Somehow, I need to implement an API key for arcGIS to use the MapServers. Implementing all of this into the plugin is above my skill level. I’m not sure how to make it work with the shortcodes.

    I don’t need to remove any tile layers. I’ll be using a custom base map I created.

    I just exported the layers as a geojson file using QGIS. So I now have my own copy that can be used with the plugin. The problem is, this is a dynamic layer that is updated as the agency adds data. I would like to keep that feature.

    If you can figure out how to seamlessly implement arcGIS data into the plugin, that would be a great advancement to this plugin. I will continue to play with it and document the process for you and other users.

    The arcGIS Leaflet plugin is widely documented on the arcGIS website.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to use data from ArcGIS REST Services Directories’ is closed to new replies.