February 2019
Beginner to intermediate
284 pages
6h 20m
English
Without any charting library, using just standard JavaScript, you can load a JSON file and draw a world map using Canvas. The data is a special JSON format that stores geographical shapes: GeoJSON. Its general structure is as follows:
{"type":"FeatureCollection", "features":[ {"type":"Feature",id":"AFG","properties":{"name":"Afghanistan"}, "geometry":{"type":"Polygon","coordinates":[[[61.210817,35.650072],...]] },{"type":"Feature", "id":"AGO", "properties":{"name":"Angola"}, "geometry":{"type":"MultiPolygon","coordinates":[[[[16.326528,-5.87747,...]] }, // many other lines ] }
Using JavaScript, you can load this file, parse it, and access each longitude and latitude pair. Then you can scale the values so that they fit into ...
Read now
Unlock full access