Your search returned no results

Try another search term or view Stack Exchange, where we have active conversations with Developers about GIS.
    Support channel in Stack Exchange

    Thousands of developers around the world have helped make CartoDB a success, and we have active conversations with them about GIS in Stack Exchange.

    Go to Stack Exchange

    Loading Map Data

    The following DataSources are available for the Mobile SDK, and are supported on all mobile platforms.

    Note: Some DataSources are more generic and can be used for different data types and map layers (vector or raster). Others can only be applied for specific layer types. Please contact us if you have questions about which DataSources are available for your account plan.

    Offline Maps from MBTiles

    MBTilesTileDataSource is universal datasource for raster, or vector, tile data.

    MBtiles as RasterTileLayer

    For raster data, use MBTiles format files, and use the following code to generate them:

    MBtiles as VectorTileLayer

    For packaged vector data, you will need CARTO specific vector files packages (NTVT - NutiTeq Vector Tile) and styling files must be in Mapnik XML format. Download the following, free sample package using OpenStreetMap data:

    The Mobile SDK provides a built-in download service thorough the Package Manager to retrieve map packages for a country, or smaller region. For details, see Offline Map Packages.

    Note: Vector maps always need proper style definitions. Fortunately, we bundle three basic styles with the SDK (bright, default, gray).

    Use the following code to use MBtiles for a vector layer:

    MBTiles for Map Data

    MBTiles contain the TileJSON formats that include basic map styling for Mapbox. MBTiles support is included in CARTO Mobile SDK. MBTiles uses the SQLite database format, which only requires one file to be downloaded and managed.

    Raster Maps

    The following tools enable you to create MBTile packages:

    • MapTiler is a utility to create MBTiles from raster geo files (GeoTIFF, JPG, ECW, and so on)

    • TileMill is an open source generator of map packages for vector geo files, such as Shapefile or PosgGIS geo data
    • MOBAC is available to download from variety of free sources, such as Bing, OpenStreetMap, and so on. You can even load it from WMS with added configuration

    • MBUtil enables you to create mbtiles from/to TMS-style tile folders, created with different utilities, such as GDAL utility

    • Portable Basemap Server is a free utility for Windows and loads data from various commercial servers and custom sources. It is also available in ESRI formats. It works mainly as WMTS server, but can create MBTiles as an extra feature

    Vector Maps

    The following vector map tools enable you to create MBTiles:

    • The Mobile SDK bundled Package Manager API downloads country-wide, or bounding box based, map packages with OpenStreetMap data. These files are not directly visible, as Package Manager downloads the files, you only use the API

    Note: If you need to create vector map files from different sources, or with your own data (e.g. Shapefiles), please contact CARTO support. Our Mobile Developers will provide you with a free converter toolchain for custom conversions.

    Online Maps

    HTTPTileDataSource is a general datasource that can be used for vector or raster tiles. You can also use CARTO or Web (HTTP) tiles for vector layers. Additionally, you can use Web (HTTP) raster tiles for map layers.

    CARTO Online Vector Tile Layer

    The Mobile SDK contains built-in vector tiles, as provided by CARTO maps as a service, and is avilale for all account plans. This is useful for basic maps. For vector styling, you can use the same assets provided for offline tiles (OSMBright with 3D buildings

    Web (HTTP) Tiles as VectorTileLayer

    Some Mobile SDK plans enable you to use other vector tile map DataSources. These are similar to custom raster map data sources, but a vector decoder is needed for correct implementation.

    • Connect to MapBox vector tiles, which have a very similar (but not identical) data structure. You can use the same (OSMBright with 3D buildings asset for vector styling

      Note: Before using these assets in your app, confirm with MapBox if this is allowed and make sure you use your MapBox license key in the URL. You may need to use your custom stylying and vector tile server URL.

    The following tags are supported in the URL definition: zoom, x, y, xflipped, yflipped, quadkey.

    Web (HTTP) Tiles as RasterTileLayer

    For online raster tiles you can use any common web tiles in PNG or JPG formats, in Spherical Mercator system. See Raster Tile Sources.

    The following tags are supported in the URL definition: zoom, x, y, xflipped, yflipped, quadkey.

    App-defined Vector Overlay

    Mobile SDK contains in-memory DataSources where applications can add vector objects as the map overlay layer.

    LocalVectorDataSource is a dynamic DataSource that is initially empty, and allows you to add or remove objects. Objects are cached and by default, all added objects are rendered. For detailed code samples, see Basic Map Features for examples of adding Points, Markers, Texts, Lines and Polygons to map.

    App-defined Ground Overlays

    BitmapOverlayRasterTileDataSource defines a bitmap image and the geographical coordinates of the bitmap. For details, see Ground Overlays.

    Virtual DataSources

    There are some DataSources which can use another DataSource as input, and apply internal processing and create a new DataSource as the result. This enables you to create a new DataSource based on a customized logic.

    • PersistentCacheTileDataSource caches HTTP tiles to a persistent sqlite database file. If the tile already exists in the database, the request to the original DataSource is ignored. This can be applied for both raster and vector tiles. The original DataSource’s expired headers are taken into account as part of the processing.
    • CompressedCacheTileDataSource

    An in-memory cache DataSource. Although layers also cache tiles, the tiles are uncompressed and usually take 2-5x more memory after being loaded. CompressedCacheTileDataSource keeps all tiles in a compressed format for better use of existing memory.

    • CombinedTileDataSource

    A tile DataSource that combines two data sources (usually offline and online) and selects tiles based on the zoom level. All requests below a specified zoom level are directed to the first DataSource. All requests at, or above, a specified zoom level are directed to the second Datasource.

    Other Built-in DataSources

    The following datasources are also built into the Mobile SDK packages.

    • AssetTileDataSource - loads offline tiles data from a folder (/sdcard or Application sandbox, depending on platform). For example, you can use zoom/x/y.png or zoom_x_y.png file naming structures for offline data

    • NMLModelLODTreeOnlineDataSource - uses NMLDB online API for “3D city” layer. 3D tools are provided as commercial service. Contact us for more information.

    • NMLModelLODTreeSqliteDataSource - An offline version of NMLModelLODTreeOnlineDataSource, model that is stored in a sqlite database file. Simple individual 3D objects (NML models) can also be added to the usual LocalVectorDataSource

    Shapefiles, GeoTIFF and other GIS DataSources

    With the GIS extension we provide OGRVectorDataSource and GDALRasterTileDataSource which can open ESRI Shapefile, GeoTIFF, KML, GML, GPX, MapInfo and many other GIS vector and raster formats. The mobile codes just defines the file and layer to be used in your mobile app. CARTO provides a commercial package for these extensions. Contact us for a free evaluation demonstration.

    Custom DataSources

    You can define a custom datasource for your mobile application. See MyMergedRasterTileDataSource from the Sample Apps for an example of using a virtual DataSource. This example uses raster data from two raster datasources and merges the map using pixel aggregations. Note that the second datasource contains transparent, or semitransparent pixels. Otherwise, the pixels from the first datasource are hidden.

    Custom DataSourced should extend one of following abstract base classes:

    • TileDataSource - for tiles (raster or vector)
    • VectorDataSource - for vector objects
    • CacheTileDataSource - for custom tile caching (it is a TileDataSource)

    Raster Tile Sources

    Raster tiles can produce a faster loading map by rendering the map based on pixels of small images. With certain account plans, you can use use external raster map tiles with the Mobile SDK. You can also create your own custom raster tile map source. This section describes the raster tile features available in the Mobile SDK.

    In order to apply a raster tile source:

    • Use the HTTPTileDataSource API function as the tile source

    • Create RasterTileLayer to apply it

    Tip: For general information about raster tiles and geospatial data, see the following Open Source Geospatial Foundation reference materials for Tile Map Service and Featured Tile Layers.

    Code Sample

    The DataSource constructor uses the following URL patterns. It requires a minimum zoom level above 0, and a maximum zoom level between 14 and 19

    The following sections provide the code for raster tile basemap urls, and a sample image.

    HERE Satellite Tiles

    RasterTileLayer hereRasterLayer = new RasterTileLayer(new CartoOnlineTileDataSource(""));

    HERE Map Tiles

    RasterTileLayer hereRasterLayer = new RasterTileLayer(new CartoOnlineTileDataSource(""));

    CARTO Positron Tiles in raster


    CARTO Dark Matter Tiles in raster{zoom}/{x}/{y}.png

    OpenStreetMap Mapnik Tiles{zoom}/{x}/{y}.png

    Note: OpenStreetMap Mapnik tiles are free for limited use. See a description of their Tile usage policy.

    Stamen Toner{zoom}/{x}/{y}.png

    Please contact Stamen directly.

    Stamen Watercolor{zoom}/{x}/{y}.png

    Please contact Stamen directly.

    Stamen Terrain - US Only{zoom}/{x}/{y}.png

    Please contact Stamen directly.


    © OpenCycleMap

    OpenCycleMap Transport{zoom}/{x}/{y}.png

    Open source resource: Thunderforest

    USGS Topo National Map (US Only){zoom}/{y}/{x}

    USGS Topo

    © USGS The National Map. The National Boundaries Dataset, National Elevation Dataset, Geographic Names Information System, National Hydrography Dataset, National Land Cover Database, National Structures Dataset, and National Transportation Dataset; U.S. Census Bureau - TIGER/Line; HERE Road Data. USGS MapServer