Introduction to data services

Data services, also known as , are services hosted in a that are used to securely store, manage, and access geographic data. They are typically created as an in your organization's .

You can access data from data services by creating client-side in your application. These are also known as , and can be used to display , , , and more.

Feature layers

If you have containing and , you can import the data to create an ArcGIS in a . To access the data, you can use the URL of the service to query and return features. You can style and display the results in a map or scene. Feature layers can also contain information as part of the service response.

How to access a feature service

  1. Import your data from a CSV, XLS, GeoJSON, or Shapefile file to create a hosted feature layer.
  2. Get the URL for the feature layer.
  3. Reference the MapLibre JS and CSS libraries.
  4. Define a data source to access and query the feature layer.
  5. Display the data in a layer.

Example

This example demonstrates how to display a feature layer. To get GeoJSON features from a feature layer, you need to provide a URL that queries the feature service and return the features in GeoJSON format.

Display a feature layer (as GeoJSON)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<script src="https://unpkg.com/maplibre-gl@5.1.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@5.1.0/dist/maplibre-gl.css" rel="stylesheet" />
<script>

   map.addSource("trailheads", {
   type: "geojson",
   data: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads/FeatureServer/0/query?f=pgeojson&where=1=1",
   });

   map.addLayer({
   id: "trailheads-circle",
   type: "circle",
   source: "trailheads",
   paint: {
      "circle-color": "hsla(0,0%,0%,0.75)",
      "circle-stroke-width": 1.5,
      "circle-stroke-color": "white",
   }
   });
</script>

Vector tile layers

If you want to access and display your data as vector tile data, you can publish a vector tile layer from a feature layer, and then display it in a map. Vector tile layers closely follow the Mapbox vector tile specification, but there a few important differences:

  • URL endpoints end in /{z}/{y}/{x}.pbf, rather than /{z}/{x}/{y}.pbf.
  • Each style may contain one source.
  • The raster and hillshade layer types are not supported.

How to access the vector tile service

  1. Import your data from a CSV, XLS, GeoJSON, or Shapefile file to create a hosted feature layer.
  2. Style the feature layer using the .
  3. Create a vector tile service by publishing the feature layer as a vector tile layer.
  4. Get the URL.
  5. Reference the MapLibre JS and CSS libraries.
  6. Set the source as the type vector and add the tiles.
  7. Define the style of the vector tile layer, found in the Style tab of the item page in your .

Example

Display a vector tile layer

This example demonstrates how you fetch the vector tiles and then use a layer of type fill to display the tiles.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<script src="https://unpkg.com/maplibre-gl@5.1.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@5.1.0/dist/maplibre-gl.css" rel="stylesheet" />
<script>

   map.addSource("parcels", {
   type: "vector",
   tiles: ["https://vectortileservices3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Santa_Monica_Mountains_Parcels_VTL/VectorTileServer/tile/{z}/{y}/{x}.pbf"]
   });

   map.addLayer({
   id: "parcels-fill",
   type: "fill",
   source: "parcels",
   "source-layer": "Santa_Monica_Mountains_Parcels",
   paint: {
      "fill-color": "hsl(200, 80%, 50%)",
      "fill-opacity": 0.5,
      "fill-outline-color": "white"
   }
   });

</script>

Map tile layers

If you want to access and display your data as a tile layer, you can publish a from a feature layer, and then display it in a map.

How to access a map tile service

  1. Import your data from a CSV, XLS, GeoJSON, or Shapefile file to create a hosted feature layer.
  2. Create a tile layer in your by navigating to its item page > Publish > Tile layer.
  3. Get the URL.
  4. Reference the MapLibre JS and CSS libraries.
  5. Define the source as the type raster and add the layer.

Example

Display a map tile layer

The example shows how to fetch raster tiles from a and display them on the map with a layer of type raster.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script src="https://unpkg.com/maplibre-gl@5.1.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@5.1.0/dist/maplibre-gl.css" rel="stylesheet" />
<script>

   map.addSource("parcels", {
      type: "raster",
      tiles: [
      "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Santa_Monica_contours_(map_tiles)/MapServer/tile/{z}/{y}/{x}?token=" + accessToken
      ]
   });

   map.addLayer({
     id: "contours-raster",
     type: "raster",
     source: "contours"
   });

</script>

Tutorials

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close