Javascript Library Reference

Our data can be loaded onto any Google map with just a few lines of code and our Javascript library. You can either use our GUI interface or create your own.

Linking the library

link to the unminified library

<script type="text/javascript" src="https://cdn.spatial.ai/spatial-1.1.0.js" ></script>

link to the minified library

<script type="text/javascript" src="https://cdn.spatial.ai/spatial-1.1.0.min.js" ></script>

Methods

loadSpatialwControls(apikey, map, mapType, colors, vibes, cssText)

This loads the Spatial GUI and hex layer.
apikey
obtained through the Spatial website
map
google.maps.Map object
mapType
The type of map which spatial is being embedded on; current options are:
  • 'google'
  • 'mapquest'
colors (optional)
dictionary of colors to use for each vibe (if you want to override the default colors)
vibes
dictionary of vibe categories and sub-categories; we can visualize any number of things on request; current options are:
  • events
  • now
  • hip
    • edgy_cool
    • up_and_coming
    • mainstream
  • foodie
    • food_trucks
    • coffee_lovers
    • organic
    • fine_dining
  • sights
    • attractions
    • monuments
    • photo_op
  • the_arts
    • theater
    • galleries
    • architecture
  • nightlife
    • dance
    • sports_bars
    • live_music
  • healthy
    • active_living
    • healthy_eats
    • outdoors
    • yoga
  • love
    • majestic_views
    • date_night
  • family
    • sports
    • excursions
    • educational
  • culture
    • lgbt
    • latin_corridor
    • chinatown
  • nature
    • parks
    • water
cssText (optional)
css string for the Spatial container (if you want to relocate it from the default, top right corner)

loadSpatial(apikey,map, mapType,colors)

This only loads the hex layer, for use with your own controls.
apikey
obtained through the Spatial website
map
google.maps.Map object
mapType
The type of map which spatial is being embedded on; current options are:
  • 'google'
  • 'mapquest'
colors (optional)
dictionary of colors to use for each vibe (if you want to override the default colors)

setVibe(vibe,state)

If you are using your own GUI controls, call this method to turn a vibe on or off.
vibe
vibe layer to be changed
state
new state (0 for off, 1 for on)