Skip to main content

Migration SDK

The Radar Maps Migration SDK allows you to easily convert your Google Maps web implementations with Radar Maps by simply swapping the script import tag.

How it works#

The Google maps import will look like one of the following:

Direct src import

<script  async  src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&loading=async&callback=initMap"></script>

Dynamic Library import

<script>  (g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({    key: "YOUR_API_KEY",    v: "weekly",    // Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).    // Add other bootstrap parameters as needed, using camel case.  });</script>

For either of these imports, simply replace these lines with the Radar Migration SDK script. Now without any further changes to the code, calls to the Google Maps API will now be made to Radar's API.

<script src="https://js.radar.com/v1/radar-migration-sdk.js?key=RADAR_PUBLISHABLE_KEY"></script>

Additionally you can specify a callback and Radar map style which is defined below.

Configuration#

Definition#

src https://js.radar.com/v1/radar-migration-sdk.js

Query Parameters#

NameDefaultPossible valuesDescription
keynone (required)stringYour Radar publishable API key.
styleradar-default-v1radar-default-v1, radar-light-v1, radar-dark-v1, CUSTOM_STYLE_IDThe style of the map. One of Radar's out-of-the box styles, or a custom style ID.

See map styles for more details.
callbacknonestringThe name of a maps callback function to be called once the library is imported

Coverage#

See Maps coverage for more details.

Support#

Have questions? We're here to help! Contact us at radar.com/support.