FATOS Developer
Developer SiteConsole
  • FATOS Developer Introduction
  • FATOS API
    • Map
      • Map control
        • Sources
        • Layers
          • Style Specification
            • Fill
            • Line
            • Symbol
            • Circle
        • Building
        • Bounds
        • Center
        • Heading
        • Flyto
        • Tilt
        • Zoom
        • Marker
          • Instance Members
        • Polyline
        • Polygon
        • Circle
        • On/Off
        • Once
        • Language
        • Theme
        • Cluster
          • Instance Members
      • Button control
      • Utilities
        • Rectangle
        • Distance
        • Area
    • Search
      • Address
      • Geocoding
      • Geofencing
      • Detail
      • Public Transport
        • Bus Route
        • Bus Route Information
        • Bus Stop Information
        • Subway Station Information
        • Subway Station Timetable
        • Public Transit POI within Radius
        • Public Transit POI on Map
        • Subway Station Transfer Information
        • Real-time Bus Location Information
        • Real-time Bus Arrival Information
    • Routing
      • Route
      • Route for truck
      • Route_v2
      • Public Transit Route Search
      • Route Graphic Data
      • Bicycle
      • Pedestrian
    • Analyze
    • Tracking
  • FATOS SDK
    • Authentication
    • Platform
      • Android
        • Start
        • Component
      • iOS
        • Start
        • Component
      • React Native
        • Start
        • Component
  • Get your API Key
  • Release Note
    • FATOS Map API
    • API Server
    • RP Server
  • Troubleshooting
    • FAQ
Powered by GitBook
On this page

Was this helpful?

  1. FATOS API
  2. Map
  3. Map control

Theme

Change the map theme

Set map theme

Parameter

Description

Type

theme

basic

light1 // Gray theme

light2 // Street theme

light3 // Background Dark, Road Color

light4 // Dark theme

satellite // Satellite theme

String

    let LatLng = {lat: 37.482890, lng: 126.896086}
    let mapInstance = new fatosmap.maps.Map(
        document.getElementById("app"),
        {
            zoom: 14,
            center: LatLng,
            maxZoom: 20,
            minZoom: 2,
            key: 'YOUR_API_KEY'
            
            // theme
            theme: 'light1' Default basic
        }
    )
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Map Event</title>
</head>
<body>
<div style="height: 100vh">
    <div id="app"></div>
</div>
<button style="position: absolute; float: top; top: 50px; left: 50px;" onclick="setTheme()">Set Theme</button>
<button style="position: absolute; float: top; top: 50px; left: 150px;" onclick="getTheme()">Get Theme</button>
<button style="position: absolute; float: top; top: 100px; left: 50px;" onclick="showTraffic(true)">Show Traffic Line</button>
<button style="position: absolute; float: top; top: 100px; left: 200px;" onclick="showTraffic(false)">Remove Traffic Line</button>
<script type="text/javascript" src="https://maps.fatos.biz/dist/fatosmap-gl.js"></script>
<script>
    let LatLng = {lat: 37.482901, lng: 126.896038};
    let mapInstance = new fatosmap.maps.Map(
        document.getElementById("app"),
        {
            zoom: 14.5,
            center: LatLng,
            maxZoom: 20,
            minZoom: 2,
            key: 'YOUR_API_KEY'
        }
    );
    function setTheme() {
        mapInstance.setTheme('light2');
    }
    function getTheme() {
        console.log(mapInstance.getTheme());
    }
    function showTraffic(bool) {
        mapInstance.setTraffic(bool)
    }
</script>
</body>
</html>
PreviousLanguageNextCluster

Last updated 3 years ago

Was this helpful?