Package: keplergl-quickvis
keplergl_quickvisOverviewUber's open-sourcekepler.glis a great browser-based
platform for interactively visualizing geospatial data. ThekeplerglPython package'sincluded
documentationis almost entirely directed at use within Jupyter, and it took a little bit of
work to figure out how to use it from a non-Jupyter Python environment.keplergl_quickvisis a simple wrapper to quickly get your geospatial objects from Python into kepler.gl in the browser. It's as simple askeplergl_quickvis --style=outdoors data.geojsonfrom the command line, or from Pythonfromkeplergl_quickvisimportVisualizeVisualize(data)FeaturesOne-line data visualizationAutomatically converts Shapely objects to GeoJSONNo configuration neededInstallMapbox API key: in order to display Mapbox-hosted maps, you need to provide
a Mapbox API key. Go toMapbox.comto get an API key.Package install:pip install keplergl_quickvisThis package has dependencies ongeojson,shapely, andgeopandas. If you
get errors when installing this package through pip, it may be easier to first
install dependencies through Conda, then installing this package. I.e.:conda install geojson shapely geopandas -c conda-forge
pip install keplergl_quickvisUsageCLIThe CLI is installed under the namekeplergl_quickvis:export MAPBOX_API_KEY=...
keplergl_quickvis --style=outdoors data.geojson
keplergl_quickvis --style=dark data1.geojson shapefile.shp geodatabase.gdbYou can supply data in anyvector format readable by GeoPandas/GDAL.Supply--helpto see the CLI's help menu:> keplergl_quickvis --help

Usage: keplergl_quickvis [OPTIONS] FILES...

  Interactively view geospatial data using kepler.gl

Options:
  --api_key TEXT  Mapbox API Key. Must be provided on the command line or
                  exist in the MAPBOX_API_KEY environment variable.
  --style TEXT    Mapbox style. Accepted values are: streets, outdoors, light,
                  dark, satellite, satellite-streets, or a custom style URL.
                  [default: streets]
  --help          Show this message and exit.Python APISimplest usage:importgeopandasasgpdfromkeplergl_quickvisimportVisualize# Create your geospatial objectsgdf=gpd.GeoDataFrame(...)# Visualize one or multiple objects at a timeVisualize(gdf,api_key=MAPBOX_API_KEY)Visualize([gdf,shapely_object,geojson_string],api_key=MAPBOX_API_KEY)More detail over the objects in your map:fromkeplergl_quickvisimportVisualizevis=Visualize(api_key=MAPBOX_API_KEY)vis.add_data(data=data,names='name of layer')vis.add_data(data=data2,names='name of layer')html_path=vis.render(open_browser=True,read_only=False)VisualizeVisualize(data=None,names=None,read_only=False,api_key=None,style=None)data(eitherNone, a single data object, or a list of data objects):A data object may be a GeoDataFrame from theGeoPandaslibrary, any geometry from theShapelylibrary, any
object from theGeoJSONlibrary, or
any GeoJSON string or dictionary. You can also provide a CSV file as a
string or a Pandas DataFrame if the DataFrame hasLatitudeandLongitudecolumns. Full documentation on the accepted data formats ishere.You can provide either a single data object, or an iterable containing
multiple allowed data objects.If data is notNone, then Visualize(data) will perform all steps, including
rendering the data to an HTML file and opening it in a new browser tab.names(eitherNone, a string, or a list of strings):This defines the names shown for each layer in Kepler.gl. IfNone, the
layers will be nameddata_0,data_1, and so on. Otherwise, ifdatais
a single object,namesshould be a string, and ifdatais an iterable,
thennamesshould be an iterable of strings.read_only(boolean): IfTrue, hides side panel to disable map customizationapi_key(string): Mapbox API key. Go toMapbox.comto get an API key. If not provided, theMAPBOX_API_KEYenvironment
variable must be set, or thestyle_urlmust point to astyle.jsonfile
that does not use Mapbox map tiles.style(string): The basemap style to use. Standard Mapbox options are:streetsoutdoorslightdarksatellitesatellite-streetsThe default isstreets. Alternatively, you can supply a path to a custom
style. A custom style created from Mapbox Studio should have a url that
starts withmapbox://. Otherwise, a custom style using third-party map
tiles should be a URL to a JSON file that conforms to theMapbox Style
Specification.Visualize.add_data()Visualize.add_data(data,names=None):data(either a single data object, or a list of data objects):A data object may be a GeoDataFrame from theGeoPandaslibrary, any geometry from theShapelylibrary, any
object from theGeoJSONlibrary, or
any GeoJSON string or dictionary. You can also provide a CSV file as a
string or a Pandas DataFrame if the DataFrame hasLatitudeandLongitudecolumns. Full documentation on the accepted data formats ishere.You can provide either a single data object, or an iterable containing
multiple allowed data objects.names(eitherNone, a string, or a list of strings):This defines the names shown for each layer in Kepler.gl. IfNone, the
layers will be nameddata_0,data_1, and so on. Otherwise, ifdatais
a single object,namesshould be a string, and ifdatais an iterable,
thennamesshould be an iterable of strings.Visualize.render()Visualize.render(open_browser=True,read_only=False)read_only(boolean): IfTrue, hides side panel to disable map customizationopen_browser(boolean): IfTrue, opens the saved HTML file in the default browserTroubleshootingThe most common reasons why a map is not displayed are:Missing Mapbox API Key: in order to display Mapbox-hosted maps, you need getan API key from Mapboxto pass an API keyData projection: Kepler.gl works only with data projected into standard WGS84 (latitude, longitude) coordinates. If you have your data in a projected coordinate system, first reproject your data into WGS84 (EPGS 4326), then try again. The CLI attempts to automatically reproject into EPSG 4326, but the Python library doesn't.If your data seems to be "floating" above the map, this is likely because your
input data have Z coordinates, so kepler.gl displays them in 3-dimensional space.Changelog0.1.0 (2019-12-05)First release on PyPI.0.2.0 (2019-12-09)Automatically attempt to reproject to EPSG 4326