jsvectormapmarkers
v0.0.4
Published
A lightweight JS library for adding markers to jsvectormap interactive maps.
Downloads
5
Maintainers
Readme
In Development...
jsvectormapmarkers is a npm package that contains a comprehensive list of country/jurisdictions/territories and city coordinates (latitude and longitude) for markers in the jsVectorMap interactive map package. The project serves as a utility packgage for jsVectorMap[1] which highlights many countries within their interactive maps.
Many countries/jurisdictions/territories are too small or unavailable in the maps, therefore this package was created to easily integrate those small parts of the world that are unavailable or too small to see in the jsVectorMap maps using Markers e.g. Marshall Islands, Aruba, Seychelles etc. Markers are little vectors that can be added to a map to highlight a specific part of the world. Coming soon is a similar methodology but for major cities of the world...
Table of Contents
Installation
The jsVectorMap library is a pre-requisite to using this pacakge, it can be installed via npm:
npm i jsvectormap
jsvectormapmarkers can then also be installed via npm:
npm i jsvectormapmarkers
Import via CDN key:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/jsvectormapmarkers.min.js">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/jsvectormapcitymarkers.min.js">
Usage
import jsVectorMap from 'jsvectormap'
import 'jsvectormap/dist/maps/world.js' //import World Map
import jsvectormapmarkers from 'jsvectormapmarkers'
//create new jsVectorMap interactive map
const map = new jsVectorMap({
selector: '#map',
map: 'world',
})
//the country name, its 2 letter ISO alpha-2 OR ISO alpha-3 code are compatible with function
const countryName = "Bermuda";
const countryISOAlpha2 = "BM";
const countryISOAlpha3 = "BMU";
var markerLatLang = getMarkerLatLng(countryName);
// var markerLatLang = getMarkerLatLng(countryISOAlpha2);
// var markerLatLang = getMarkerLatLng(countryISOAlpha3);
//marker object contains lat/long on map, the name of the marker and the status
var marker = {latLng: markerLatLang, name: "Bermuda", status: 'mrk'}
//call function to add marker to map
map.addMarkers(marker);
Issues
Please feel free to raise an Issue in the Issues tab for any such cases and I will try to rectify it.
Any other issues, errors or bugs can be raised via the Issues tab in the repository.
Contact
If you have any questions or feedback, please contact [email protected] or visit my LinkedIn:
License
Distributed under the MIT License. See LICENSE
for more details.
References
[1]: https://github.com/themustafaomar/jsvectormap