Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Practical GIS

You're reading from  Practical GIS

Product type Book
Published in Jun 2017
Publisher Packt
ISBN-13 9781787123328
Pages 428 pages
Edition 1st Edition
Languages

Table of Contents (22) Chapters

Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface
1. Setting Up Your Environment 2. Accessing GIS Data With QGIS 3. Using Vector Data Effectively 4. Creating Digital Maps 5. Exporting Your Data 6. Feeding a PostGIS Database 7. A PostGIS Overview 8. Spatial Analysis in QGIS 9. Spatial Analysis on Steroids - Using PostGIS 10. A Typical GIS Problem 11. Showcasing Your Data 12. Styling Your Data in GeoServer 13. Creating a Web Map 14. Appendix

Creating web maps with Leaflet


Now we have everything in place except our maps. To create interactive maps, we can use external web mapping libraries written in JavaScript. One such library is Leaflet, which is perfectly capable of creating simple interactive maps. Leaflet has a simple and intuitive API, which is very easy to use. All we need is the library's code base and stylesheet loaded in our HTML document. Let's include Leaflet in our web page:

  1. Download the stable version of Leaflet from http://leafletjs.com/download.html.
  2. Extract the files in the downloaded archive in the web server's root folder. Optionally, create a new folder for the files to have a well-organized structure.
  3. Edit the map.html file with a code or text editor.
  4. Include Leaflet's code base (leaflet.js) with a <script> element using its relative path from the root folder in the HTML document's <head> section:
        <script src="leaflet/leaflet.js" type="text/javascript">
        </script>
  1. Include...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}