Insert a custom Open Street Map (OSM) widget map pointing to a specified location in just 3 min !
You don't need to code anything, neither to be a great designer : simply copy-paste these little pieces of code at the specified place 😋 You'll just need to create a MapBox account to use great background design. It's free and Open Source, perfect for a Contact Page, a Column or Widget... !
- Use OSM to find the coordinates,
- Replace
[XXX-LATITUDE-XXX, XXX-LONGITUDE-XXX]
insidejavascript_part.js
file with your coordinates → example :[53.266803,-9.046916]
Same method. Obviously, you can use the same coordinates as your marker. Then, replace [XXX-LATITUDE-CENTER-XXX, XXX-LONGITUDE-CENTER-XXX]
inside javascript_part.js
code.
- Create an account on MapBox website : https://www.mapbox.com
- Get your individual Access Token : "Account" > Tab "API access token" in the upper right menu > click on "Default Public Token" to show your Access Token
- Replace
XXX-YOUR-MAPBOX-ACCESS-TOKEN-XXX
insidejavascript_part.js
code. - Choose the type of background you want to use for your widget : light / dark / streets / outdoors / satellite... and set
id: 'mapbox.streets'
insidejavascript_part.js
code.
- Insert
head_part.html
code inside the
Tags of your website. Thanks to keep credit's mentions 😄<head></head>
- Insert
css_part.css
code into <style></style> Tags inside
Tags just after<head></head>
head_part.html
code, - Insert
body_part.html
where you want to display your map, - Insert
javascript_part.js
inside <script></script> Tags, just afterbody_part.html
, - Brew a delicious tea 🍵 & enjoy !
(CC-BY) Creative Commons Attribution https://creativecommons.org/licenses/by/2.0/fr/
Guillaume ROUAN | 2016
💬 Github/Twitter : @grouan | http://guillaume-rouan.net