Let's get started. Contrary to most examples, it will need more code than usual. So, to keep things simple, we will explain how to build the sample by retrieving the various code files instead of inlining it. After these operations, we will focus on the important parts of the code to understand them:
Go to the samples directory and retrieve all the
css
class with theexport-geojson
string fromassets/css/samples.css
and copy paste them in your ownsamples.css
file. Next, retrieve a new JavaScript file from https://github.com/eligrey/FileSaver.js/blob/master/FileSaver.js into a new subdirectory,assets/js
.If you don't already have it from Chapter 8, Interacting with Your Map, go to download the
features.geojson
file fromassets/data/features.geojson
, within the book samples.Then, retrieve the code from
chapter09/2360OS_09_06_custom_control.html
.Finally, run node
index.js
, open your browser, and draw something. Push on...