Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

12.4 KB
Raw Blame

Add Data to the Map

Ways to Add Data

  • Open kepler.gl/demo. You should see the following prompt:

Add data to the map pop up

kepler.gl is a pure client side app. Data lives only in your machine/browser. No information or maps is sent back up to our server.

  • Choose one of three ways to add data to your map
Local files Upload CSV, GeoJSON, GeoJSONL, KML, GPX, TCX, Shapefile, Excel, FlatGeobuf, Arrow, or Parquet files, or a zip of those files. Files are parsed in your browser, so available memory limits how large a file you can load. For data that does not fit in memory, use a tileset instead.
From URL Directly load data or map json by pasting a remote URL. Supported extensions include csv, geojson, json, geojsonl, kml, gpx, tcx, shp, xlsx, fgb, arrow, and parquet. Make sure the url contains the file extension. CORS policy must be defined on your custom url domain.
Sample data Load one of kepler.gl’s sample datasets. The sample map data and config are directly loaded from kepler.gl-data github repo

Supported Projection Coordinate System

kepler.gl only supports Web Mercator EPSG:3857 -- WGS84.

Geometry coordinates should be presented with a geographic coordinate reference system, using the WGS84 datum, and with longitude and latitude units of decimal degrees.

Supported File Formats

CSV

CSV file should contain header row and multiple columns. Each row should be 1 feature. Each column should contain only 1 data type, based on which kepler.gl will use to create layers and filters.

id point_latitude point_longitude value start_time
a 31.2384 -127.30948 5 2019-08-01 12:00
b 31.2311 -127.30231 11 2019-08-01 12:05
c 31.2334 -127.30238 9 2019-08-01 11:55

1. Data type detection

Because CSV file content is uploaded as strings, kepler.gl will attempt to detect column data type by parsing a sample of data in each column. kepler.gl can detect

type data
boolean True, False
date 2019-01-01
geojson WKT string: POLYGON ((-74.158 40.835, -74.148 40.830, -74.151 40.832, -74.158 40.835)), or GeoJson String {"type":"Polygon","coordinates":[[[-74.158,40.835],[-74.157,40.839],[-74.148,40.830],[-74.150,40.833],[-74.151,40.832],[-74.158,40.835]]]}
integer 1, 2, 3
real -74.158, 40.832
string hello, world
timestamp 2018-09-01 00:00, 1570306147, 1570306147000

Note: Make sure to clean up values such as N/A, Null, \N. If your column contains mixed type, kepler.gl will treat it as string to be safe.

2. Layer detection based on column names

kepler.gl will auto detect layer, if the column names follows certain naming convention. kepler.gl creates a point layer if your CSV has columns that are named <name>_lat and <name>_lng or <name>_latitude and <name>_longitude, or <name>_lat and <name>_lon. Uncheck Auto create layers, then click Add Data to load a file or tileset without creating layers.

layer auto create layer from column names
Point Point layer names have to be in pairs, and ends with <foo>lat, <foo>lng; <foo>latitude, <foo>longitude; <foo>lat, <foo>lon
Arc If two points layers are detected, one arc layer will be created
Icon A column named icon is present
H3 A column named h3_id or hexagon_id is present
Polygon A column content contains geojson data types. Acceptable formats include Well-Known Text e.g. POLYGON ((-74.158 40.835, -74.148 40.830, -74.151 40.832, -74.158 40.835)) and GeoJSON Geometry. e.g. {"type":"LineString","coordinates":[[100.0, 0.0],[101.0, 1.0]]}

3. Embed Geometries in CSV

Geometries (Polygons, Points, LineStrings etc) can be embedded into CSV as a GeoJSON or WKT formatted string.

GeoJSON String

Use the geometry of a Feature, which includes type and coordinates. It should be a JSON formatted string, with the " corrected escaped. More info on String escape in csv

Example data.csv with GeoJSON

id,geometry
1,"{""type"":""Polygon"",""coordinates"":[[[-74.158491,40.835947],[-74.157914,40.83902]]]}"
WKTString

The Well-Known Text (WKT) representation of geometry values is designed for exchanging geometry data in ASCII form.

Example data.csv with WKT

id,geometry
1,"POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))"

GeoJSON

1. Feature types

  • kepler.gl accepts GeoJSON formatted JSON that contains a single Feature object or a FeatureCollection object. kepler.gl creates one Polygon layer per GeoJSON file.

    • A single GeoJSON Feature:
      {
        "type": "Feature",
        "geometry": {
          "type": "Polygon",
          "coordinates": [
            [
              [-10.0, -10.0],
              [10.0, -10.0],
              [10.0, 10.0],
              [-10.0, -10.0]
            ]
          ]
        },
        "properties": {
          "name": "foo"
        }
      }
    
    • GeoJSON Feature Collection.
    {
      "type": "FeatureCollection",
      "features": [{
          "type": "Feature",
          "geometry": {
              "type": "Point",
              "coordinates": [102.0, 0.5]
          },
          "properties": {
              "prop0": "value0"
          }
      }, {
          "type": "Feature",
          "geometry": {
              "type": "LineString",
              "coordinates": [
                  [102.0, 0.0],
                  [103.0, 1.0],
                  [104.0, 0.0],
                  [105.0, 1.0]
              ]
          },
          "properties": {
            "prop0": "value0"
          }
      }]
    }
    

    kepler.gl will render all features in one Polygon layer even though they have different geometry types. Acceptable geometry types are

    Feature properties will be parsed as columns. You can apply color, filters based on them.

2. Auto styling

kepler.gl will read styles from GeoJSON files. If you are a GeoJSON expert, you can add style declarations to feature properties. kepler.gl will use the declarations to automatically style your feature. The acceptable style properties are:

"properties": {
  "lineColor": [130, 154, 227],
  "lineWidth": 0.5,
  "fillColor": [255, 0, 0],
  "radius": 1 // Point
}
  • See an example below:
{
  "type": "FeatureCollection",
  "features": [{
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [-105.1547889, 39.9862516],
          [-105.1547167, 39.9862691]
        ]
      },
      "properties": {
        "id": "a1398a11-d1ce-421c-bf66-a456ff525de9",
        "lineColor": [130, 154, 227],
        "lineWidth": 0.1
      }
  }]
}

GeoJSONL / NDJSON

kepler.gl accepts newline-delimited GeoJSON: one Feature per line. Common extensions are .geojsonl, .ndgeojson, .ldgeojson, .jsonl, and .ndjson. Features are combined into a FeatureCollection and visualized like a GeoJSON file.

Generic NDJSON (one JSON object per line, without GeoJSON geometry) is loaded as a table, the same way as CSV.

Example places.geojsonl:

{"type":"Feature","properties":{"name":"alpha"},"geometry":{"type":"Point","coordinates":[-122.4,37.8]}}
{"type":"Feature","properties":{"name":"beta"},"geometry":{"type":"Point","coordinates":[-122.5,37.9]}}

KML

kepler.gl accepts .kml files. Placemarks are converted to GeoJSON features and visualized with a Polygon layer. .kmz (zipped KML) is not supported; unzip the archive and upload the .kml file. KML styles, overlays, and network links are not preserved.

GPX

kepler.gl accepts .gpx files. Waypoints, tracks, and routes are converted to GeoJSON features. NMEA log files are not supported.

TCX

kepler.gl accepts Garmin .tcx activity files. Track points are converted to GeoJSON features.

Shapefile

kepler.gl accepts ESRI Shapefiles. Drop a .shp together with its sidecars (.dbf, .shx, and optionally .prj / .cpg), or a .zip that contains one shapefile and those sidecars at the top level. A zip of a single shapefile loads as one dataset named after the zip. Features are converted to GeoJSON and visualized with a Polygon layer. If a .prj file is present, geometries are reprojected to WGS84. Nested folders inside the zip are ignored.

Zip

A .zip can hold more than one dataset. Each supported file at the top level becomes its own dataset, named with the file name inside the archive. CSV, GeoJSON, GeoJSONL, KML, GPX, TCX, Excel, FlatGeobuf, Arrow, Parquet, and Shapefile are recognized. Shapefile sidecars stay with the .shp they belong to, and a zip of several shapefiles loads each one. Nested folders are ignored. Files kepler.gl cannot load are skipped. A zip with nothing supported reports an error.

A zip that contains a single shapefile and its sidecars stays one dataset named after the zip.

Excel

kepler.gl accepts .xlsx and .xls workbooks. The first sheet is loaded as a table, the same way as CSV. Additional sheets are not imported.

FlatGeobuf

kepler.gl accepts .fgb files. Features are converted to GeoJSON and visualized with a Polygon layer.

GeoArrow

GeoArrow file, a binary data format which can be visualized with the PolygonLayer.

kepler.gl JSON

JSON file exported from kepler.gl. See "Export Map as JSON".

Load Map Using URL

You load data or map through custom URL. It currently supports URLs with file extension of csv, json, geojson, geojsonl, kml, gpx, tcx, shp, xlsx, fgb, arrow, parquet, and kepler.gl.json.

A remote URL still loads the full file into memory. For datasets that do not fit in memory, use a tileset (vector tiles, COG, or PMTiles).

Load Map Using URL

Use Kepler.gl’s Sample Maps

The sample maps are a great option for new users to explore Kepler.gl and get a feel for how it works.

  1. At the initial load prompt select “Try sample data” in the top right corner.

Try sample data pop up

  1. Choose from the options to load the sample map and explore the configurations applied.

Choose sample data pop up

Add multiple datasets

To add additional datasets to your map:

  1. Click Add More Data in the top right corner.

Add more data

  1. Choose one of the options above: upload a supported file, paste a URL, or use Kepler.gl’s sample data.

  2. Repeat as needed. There is no limit on the number of datasets you can add. However, adding too many might cause its performance to suffer.

Back to table of contents