понедельник, апреля 16, 2018

Truesize for Leaflet


It is very easy to create a country size comparison map like The True Size Of using the Google Maps API. Google's Maps API allows you to define polygon shapes as both draggable and geodesic. This means if you add a country polygon shape to a Google Map the map's users can drag the shape around the map and the size will change size depending on the shape's latitude.

In Leaflet.js there is no simple method in the JavaScript library for making a polygon shape both draggable and responsive to the map projection. Therefore Webkid has created a plug-in for Leaflet which allows you to add draggable polygons that resize automatically depending on the degree of latitude.

Leaflet Truesize includes links to download the plugin and an explanation of how it should be used to create a size comparison map. It also contains an example map which allows you to drag India and Mexico on a map to compare their size with other countries around the world.

Комментариев нет: