Added package.json

This commit is contained in:
Simon Brooke 2020-02-25 17:35:30 +00:00
parent b47ab9cc36
commit 80e5198b32
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
2 changed files with 44 additions and 4 deletions

View file

@ -80,6 +80,12 @@ var GeoCSV = {
* Methods related to locating and presenting data on the map * Methods related to locating and presenting data on the map
*/ */
GIS: { GIS: {
/**
* the relative or absolute URL of the place where map pin images may be
* fetched from.
*/
iconUrlBase: "img/map-pins/",
/** /**
* Return an appropriate pin image name for this `record`. * Return an appropriate pin image name for this `record`.
*/ */
@ -124,13 +130,13 @@ var GeoCSV = {
if ( !isNaN( lat) && !isNaN( lng)) { if ( !isNaN( lat) && !isNaN( lng)) {
var pin = L.icon( {iconAnchor: [16, 41], var pin = L.icon( {iconAnchor: [16, 41],
iconSize: [32, 42], iconSize: [32, 42],
iconUrl: "img/map-pins/" + iconUrl: this.iconUrlBase +
this.pinImage( record) + this.pinImage( record) +
".png", ".png",
riseOnHover: true, riseOnHover: true,
shadowAnchor: [16, 23], shadowAnchor: [16, 23],
shadowSize: [57, 24], shadowSize: [57, 24],
shadowUrl: "img/map-pins/shadow_pin.png"}); shadowUrl: this.iconUrlBase + "shadow_pin.png"});
var marker = L.marker( L.latLng( lat, lng), var marker = L.marker( L.latLng( lat, lng),
{icon: pin, title: record["name"]}); {icon: pin, title: record["name"]});
marker.bindPopup( this.popupContent( record)); marker.bindPopup( this.popupContent( record));
@ -184,8 +190,6 @@ var GeoCSV = {
view.fitBounds( [[ maxLat, maxLng], view.fitBounds( [[ maxLat, maxLng],
[ minLat, minLng]]); [ minLat, minLng]]);
} }
//return [ minLat + ( ( maxLat - minLat) / 2),
// minLng + ( ( maxLng - minLng) / 2)];
} }
}, },
@ -315,5 +319,13 @@ var GeoCSV = {
this.Notify.error( error); this.Notify.error( error);
} }
} }
},
/**
* Set the base address from which to serve icon (map pin) URLs to thia
* `iconUrlBase` value.
*/
setIconUrlBase( iconUrlBase) {
this.GIS.iconUrlBase = String( iconUrlBase);
} }
} }

28
package.json Normal file
View file

@ -0,0 +1,28 @@
{
"name": "@simon_brooke/geocsv",
"version": "1.0.0",
"description": "An ultra-lightweight tool to show comma-separated value data on a map.",
"main": "js/geocsv.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/simon-brooke/geocsv-js.git"
},
"keywords": [
"CSV",
"map",
"GIS"
],
"author": "Simon Brooke",
"license": "GPL-2.0-or-later",
"bugs": {
"url": "https://github.com/simon-brooke/geocsv-js/issues"
},
"homepage": "https://simon-brooke.github.io/geocsv-js/",
"dependencies": {
"leaflet": "^1.6.0",
"papaparse": "^5.1.1"
}
}