

Next, HTML code is used to give the page a title between the and tags. Anything appearing between is considered a comment and will be invisible on the final webmap. įirst, we use HTML code to provide some comments about the code we’re using. There are a few things happening in this code block. Open it with a text editor, such as Sublime Text, Notepad (Windows), or TextEdit (Mac). Navigate to the leaflet-demo folder, then right click on the 01.html file. We’ll be looking at a series of steps that build on each other to create a simple webmap. Clicking on the points will open a pop-up window showing more details about the businesses. You should see a map of Ottawa with points showing the Rideau Street businesses.

Navigate to localhost/leaflet-demo/leaflet-test.html. Next, download the leaflet-demo folder, unzip it and move it to the This will launch your web browser. Click on it and navigate to the www directory. A green “W” icon should appear in your taskbar. You may be prompted to select your preferred web browser and text editor.
USING TEXT EDIT FOR LEAFLET MAC INSTALL
Starting a web server (Windows)ĭownload and install WampServer. To make sure everything is configured correctly, navigate to localhost:8000/leaflet-test.html in your web browser. We’ll keep the terminal window open in the background while we work on our Leaflet map. Next, type python -m SimpleHTTPServer 8000 and press enter to launch the web server. If you see leaflet-demo in the list, navigate to it by typing cd leaflet-demo and pressing enter. This will list the contents of the directory. This will make sure you start in the home directory. If the leaflet-demo folder is in your home directory, it should be visible when we list the files. You’ll see a prompt where commands can be entered.įor this exercise, we need to navigate to the leaflet-demo folder to launch SimpleHTTPServer. Open a Terminal window by searching for “Terminal” in the Spotlight Search. It is a command line tool (but don’t be afraid!). There’s a Python-based one that is built into Mac computers called SimpleHTTPServer. I recommend adding the folder to your home directory, which you can open with the shortcut Shift - Command - H.Ī local web server is necessary to run Leaflet offline in your browser. Save it to your computer in an easily accessible location. Starting a web server (Mac)įirst, download the leaflet-demo folder. Options include running SimpleHTTPServer in your Leaflet example folder, or installing MAMP (Mac) or WampServer (Windows). We’ll be creating offline Leaflet maps in this exercise, but it will be necessary to set up a local web server to load the data files (if your points don’t appear after the test in step one, this is probably why).
