Skip to content

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dual Maps 3D — API Reference

A three-panel map viewer combining a Google 2D map, Google Street View, and a CesiumJS photorealistic 3D Earth — all synchronised in real time.


1. Google Maps API Key Setup

Dual Maps 3D requires a Google Maps API key with the following APIs enabled:

  • Maps JavaScript API — 2D map and Street View
  • Map Tiles API — Google Photorealistic 3D Tiles (CesiumJS)
  • (Optional) Places API — only if using Google Places Search

Steps

  1. Go to console.cloud.google.com
  2. Create or select a project
  3. Navigate to APIs & Services → Library and enable each API listed above
  4. Navigate to APIs & Services → Credentials and create an API key
  5. Under Key restrictions → HTTP referrers, add your domain:
    • yourdomain.com/*
    • https://yourdomain.com/ (explicit entry also required)
    • For local testing: localhost/*

Note: The Map Tiles API must be enabled separately from the Maps JavaScript API even though they share the same key. Both must be enabled for the 3D Earth panel to load.

Adding the key to the page

Your key should be hard-coded directly into dem1.htm :

window.apikey = params.get('key') || 'YOUR_API_KEY';

2. Loading the Base Page

With the files served from a local or remote web server, open:

dem1.htm

With no parameters the page loads with these defaults:

Setting Default value
Location San Francisco, CA (37.7918, -122.3904)
2D map zoom 18
2D map type Road map
Panels visible 2D Map + Street View + 3D Earth
Street View Nearest panorama to the default location
3D camera tilt 45°
3D camera range 400 m
3D camera heading 0° (North)
Search bar Nominatim (OpenStreetMap)
Labels / POI On

Controls

Control Action
Map / Street / 3D checkboxes Show or hide each panel
Labels checkbox Toggle labels and POI on both 2D and 3D panels
Orbit button Start/stop automatic orbit of the 3D camera
Search bar Type a place name and press Go (Nominatim) or use autocomplete (Google)
Settings (gear icon) Change place marker colour, title, and description
Fullscreen button Expand to browser fullscreen
⚙ Create icon Return to the Blazor settings form to change parameters

Mouse / Touch

Input 2D Map 3D Earth
Left drag Pan Pan
Right drag — Rotate heading + tilt
Scroll wheel Zoom Zoom (range)
Click Move place marker Sync centre to clicked point
Two-finger drag Pan Pan
Two-finger vertical — Pitch

3. URL Parameters

All parameters are optional. Append them to dem1.htm as a query string:

dem1.htm?lat=51.5074&lng=-0.1278&z=16&pt=London

3.1 Location & 2D Map

Parameter Type Default Description
lat float 37.7918 Initial latitude
lng float -122.3904 Initial longitude
z int (1–20) 18 2D map zoom level
gm int (0–3) 0 2D map type: 0=road, 1=satellite, 2=hybrid, 3=terrain
pt string (none) Place title shown in header and info window
pd string (none) Place description shown in info window

3.2 Street View

Parameter Type Default Description
slat float same as lat Street View latitude
slng float same as lng Street View longitude
sh float (0–360) auto Street View heading in degrees. Omit to auto-face the place marker
sp float 0 Street View pitch in degrees (−90 to +90)
sz float 1 Street View zoom level
pano string (none) Load a specific panorama by ID. Takes priority over slat/slng when present

3.3 3D Earth Camera

Parameter Type Default Description
et float (0–85) 45 3D camera tilt in degrees (0 = top-down, 85 = near-horizontal)
er float 400 3D camera range (distance to look-at point) in metres
eh float (0–360) 0 3D camera heading in degrees (0 = North)

3.4 Panels

Parameter Type Default Description
panel string mse Which panels to show. Combine letters: m=2D map, s=Street View, e=3D Earth. E.g. panel=ms hides the 3D panel

3.5 UI & Behaviour

Parameter Type Default Description
search string 1 Search mode: 1 = Nominatim OpenStreetMap search bar; omit or any other value = no search UI
mv 0/1 1 Place marker visible
md 0/1 1 Place marker draggable
pv 0/1 1 POI / Labels visible

4. Example URLs

London, Street View only:

dem1.htm?lat=51.5074&lng=-0.1278&z=16&pt=London&panel=s

Eiffel Tower, all panels, angled 3D camera:

dem1.htm?lat=48.8584&lng=2.2945&z=17&pt=Eiffel+Tower&et=60&er=600&eh=45

Specific Street View panorama:

dem1.htm?lat=48.8584&lng=2.2945&pano=PANORAMA_ID&sh=180&sp=5

2D map + 3D only (no Street View), satellite base map:

dem1.htm?lat=27.9881&lng=86.9250&z=14&pt=Everest&panel=me&gm=1&et=70&er=2000

No search bar, no place marker:

dem1.htm?lat=40.7484&lng=-73.9857&z=17&pt=Empire+State&mv=0&search=0

5. Live URL Sharing

The page continuously updates the browser URL as you navigate. The current URL at any point is a shareable link that will restore the exact same view, including:

  • 2D map centre and zoom
  • Street View position, heading, pitch, zoom, and panorama ID
  • 3D camera tilt, range, and heading
  • Visible panels

Copy the URL from the browser address bar to share a specific location and view.


6. Notes

  • Photorealistic 3D Tiles require the Map Tiles API to be enabled in your Google Cloud project. The 3D panel will show a blank globe if this API is not enabled or if the key is missing.
  • Nominatim (the default search) is a free OpenStreetMap geocoder. It requires no API key but is rate-limited to one request per second. Use it for personal or low-traffic projects; for high-traffic use enable search=google with a Places API key.
  • User-generated panoramas are included in Street View by default. These are community-contributed images in addition to official Google Street View coverage.
  • Mobile: panels stack vertically in portrait orientation. The search bar is hidden on mobile; use URL parameters to pre-set the location.

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages