Join us online - 19th of November
Save your spot
For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Data sources

A data source provides the data for your map. Data defines the features that are visible on the map and that you can style according to your needs. Each style layer in your map has a defined source. In MapTiler Map Designer, you can find the data source used for a specific layer in the Data tab under Sources.

data-source.png

You can add either MapTiler data sources or your own. Data sources can be of two types: Tiles or Vector data file (GeoJSON). Tiles include a Standard tiles section with global data, Country specific tiles and if you add your own, you will get a My Tiles section. For upload of your own tileset, supported containers are GeoPackage or MBTiles with raster (PNG, JPG, or WebP) or vector tiles (MVT format). You can process your own data easily into tiles with MapTiler Engine software.

Vector MapTiler data sources that you can find in the Standard tiles section have their detailed schemas. From the schema, you can discover everything from layer names or fields to maps in which the data source is included.

tiles.png

Vector data files include your own data either created from scratch in our Vector data editor or uploaded in geo formats (supported are GeoJSON, GPX, KML, and zipped SHP). The maximum allowed file size is 10 MB with 10 000 features; hence this approach is suitable for small datasets. With bigger files, we recommend tiling your data to get the best performance.

data.png

Work with data sources programmatically

As tiles are the raw data, to turn them into a map you also need information on how to style the data. Tiles are useful where you want to combine elements of different datasets into one map.

MapTiler Tiles API offers several standard tilesets for everyone to use in their maps, such as MapTiler Planet, OpenMapTiles, Countries, Contours, Terrain, Satellite, etc. You can also upload your own.

Live example: MapTiler Planet tileset

To add a tileset in a vector tile custom style, add a new data source in the sources section of the JSON style and write the URL of the tileset in the url property.

Example: JSON style fragment with two tilesets


{
..........
  "sources": {
    "satellite": {
      "url": "https://api.maptiler.com/tiles/satellite-v2/tiles.json?key=mNLmXyaTH4gRlwJHSYWp",
      "tileSize": 512,
      "type": "raster"
    },
    "openmaptiles": {
      "url": "https://api.maptiler.com/tiles/v4/tiles.json?key=mNLmXyaTH4gRlwJHSYWp",
      "type": "vector"
    }
  }
.........
}

Work with data sources in Map Designer

In MapTiler Map Designer, you can manipulate the data sources from the Data sources panel (puzzle icon or Alt+D). You will find all data sources used in your map there, including the data layers. If a layer is not used in your map but is available, it will be greyed out.

In the example below, we have a MapTiler Planet data source with layers such as “aerodrome_label”, “boundary”, “landcover”, etc. “Housenumber” or “mountain_peak” layers are available but not used in our map.

data-sources-panel.png

After clicking on a specific data layer, MapTiler Map Designer will tell you what map style layers it is included in, what attributes it has, and what you have filtered in the map. 

In our case, map style layers “Other border”, “Disputed border” and “Country border” use data from the “boundary” layer. You can also see that in the map we don’t use maritime boundaries (Maritime=Yes is not selected in the filter).

attributes.png

Add a new data source

To add a data source, use the “plus” button next to the search. In the dialogue window, you will see all available data sources with information (type, zoom, and date of creation) including your own uploaded data. When selecting your preferred data source, there is an overview map on the right which you can zoom in to explore the data thoroughly.

add-data-source.png

Once you have the data source added, you can go to the Layers panel (Alt+L) and include it in your style layers. It will appear as an option in a Source drop-down menu in the Data panel. However, be aware that raster sources can be chosen only for raster layers and vectors for vector layers.

add-to-map.png

Add a style layer

A data source can also be added directly as a new style layer. Go to the Layers panel > “plus” button > Add a new layer to enrich your map.

add-style-layer.png

In the case of rasters, you will choose your layer, geometry, and how it should be included in the map (Parent block, Visualization, Layer name) and you can style it right away.

add-raster.png

In this example, we are adding Terrain RGB into the Terrain block as a Hillshade. Below you can see how the map looks with the Terrain included.

terrain.png

In the case of vectors, apart from choosing a geometry, you will be asked to look at filters before adding a layer to your map. This way, you can choose to include only specific classes, names, or other values. As an example, we are adding mountain peaks to our map. 

add-vector.png

Replace a data source

Replacing data sources can be very useful in case of updates, for example when you switch to a newer version of a dataset.

Data sources can be replaced only if they cover the same style layers as the initial source. A raster data source can only be replaced by another raster data source, and a vector data source only by another vector data source.

Go to the Data source panel > right-click the Data source > Replace data source…

1.png

After clicking “Replace data source” you will see the complete list of your available data sources (stored in your MapTiler account). You can even use the search bar at the top left corner of the context window.

2.png

After you find the right data source, click it and a comparison preview will appear in the right part of the context window. This will help you quickly check what changes will be done to the map if you decide to complete the replacement of the data sources.

3.png

Once you are satisfied with the preview, click the blue “Continue” button in the lower left part of the context window.

4.png

The Map Designer tool will let you know if this action would cause any style layers to be changed or removed from your map.

5.png

To complete the replacement process click the blue “Replace” button in the lower right part of the context window.

6.png

Why the data sources must match

The map style references the data source’s layers by name. If you replace a source with one that has a different structure, layers in your map could break or disappear, even if the two sources share some layers. The original and the new data source must therefore have a compatible schema, where features (roads, rivers, lakes…) use the same structure and naming. Read more about the schemas of MapTiler datasets.

Delete a data source

You can also delete a data source: right-click it in the Data source panel, the same way as when replacing it. Map Designer will let you know if this action would cause any style layers to be removed from your map.

remove.png

Was this helpful?