Tag: OpenStreetMap

  • Research: Styling OpenStreetMap

    Research: Styling OpenStreetMap

    (this article is work in progress …)

    I often wondered whether you could create your own styles for OpenStreetMap by some CSS and avoid commercial solutions like Mapbox.

    Here are the links to resources about OpenStreetMap and how to style the maps on web pages.

    Leaflet Styles

    Leaflet is a cool JavaScript / CSS library for adding markers, popups and similar to OpenStreetMap maps. Since the library has a CSS library, you could tweak the setings by additional CSS after the link to the Leaflet CSS. E.g.:

    <link 
            rel="stylesheet" 
            href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
            integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
            crossorigin=""/>
    <style>
      /** tweak something here ... see below */
    </style>

    Here are the typical Leaflet Styles: see it here.

    If we look into these styles an alternative CSS could be added, eg.:

    /* visual tweaks */
    .leaflet-container {
    	background: #ddd;
    	outline-offset: 1px;
    	}

    In the we should be able to tweak a map and change the background color hex to somethig different here.

    Since Leaflet has tweaks to font styles you could change the look and feel of things here.

  • Open Streetmap API (embed)



    View Larger Map

    Here Open Street Maps is embedded via a simple i-frame – but it’s just a standard map. Not much Leaflet or Mapbox styling is possible when we use the OSM embed options. But at least you may add a marker via the OSM web page. As far as I can see the marker is made via Leaflet somehow.

    Since the AUH is a behemoth building complex. But you can use the pointer in order to pinpoint an entrance or building.

Enable Notifications OK No thanks

We use cookies - more information

Multimusen.dk will set a few cookies from Doubleclick, Google and the Social Media plugins they ay set some cookies. Some of my pages use APIs - such as YouTube, LinkedIn, Google Fonts, Google Maps, Mapbox, Spotify, Jetpack, Twitter, Facebook &c.. Such plugins may set the odd cookie.

Close