LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

How can you display a user's location on a map?

Feed the coordinates into a map service — either a static-map image URL (like Google Static Maps) or an interactive JavaScript mapping library (like Leaflet).

Static Map (image URL):

<img src="https://maps.googleapis.com/maps/api/staticmap?
    center=47.05,8.31&zoom=14&size=800x600&key=YOUR_KEY">

JavaScript libraries:

  • Google Maps JavaScript API
  • Leaflet (open source)
  • Mapbox
  • OpenLayers

Important considerations:

  • Most map APIs require an API key
  • API keys are often visible in client-side code (security risk!)
  • Many services charge after a certain number of requests
  • Best practice: Use API key only server-side, or restrict by domain/IP

Map providers: Google, TomTom, Mapbox, HERE, MapFit, Leaflet (uses OpenStreetMap)

From Quiz: WEBT / Geolocation API and Responsive Layouts | Updated: Jun 20, 2026