New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

geojson-popup

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geojson-popup - npm Package Compare versions

Comparing version 1.1.0-beta to 2.0.0-beta

dist/geojson-popup.js

41

package.json
{
"name": "geojson-popup",
"// Deprecated name": "popup-geojson-map",
"version": "1.1.0-beta",
"description": "Add GeoJSON-based templated popups to your Leaflet map. See audio-player example.",
"version": "2.0.0-beta",
"description": "Add GeoJSON-based templated popups to your Leaflet map. See the audio-player example.",
"license": "MIT",
"main": "src/popup-geojson-map.js",
"browser": "src/popup-geojson-map.js",
"unpkg": "dist/geojson-popup.js",
"X-browser": "dist/geojson-popup.js",
"main": "index.js",
"author": "Nick Freear {@nfreear}",

@@ -17,8 +18,20 @@ "keywords": "geojson, map, leaflet, audio, lodash, underscore, template, popup, freesound, commons, mapbox, popup-geojson-map",

},
"peerDependencies": {
"leaflet": "^1.0.3"
},
"devDependencies": {
"browserify": "^14.4.0",
"eslint": "^3.19.0",
"exorcist": "^0.4.0",
"jsonlint-cli": "^1.0.1",
"node-static": "^0.7.9"
"node-static": "^0.7.9",
"replace": "^0.3.0",
"semistandard": "^11.0.0",
"uglify-js": "^3.0.20",
"uncomment-cli": "git://github.com/nfreear/uncomment-cli.git#86d0bbc129"
},
"files": [
"dist/geojson-popup.js",
"dist/*.js.map",
"dist/*.min.js",
"src/",

@@ -32,14 +45,19 @@ "data/",

"scripts": {
"build": "bin/_ver.js && npm run browserify && npm run uglify",
"browserify": "browserify index.js --debug | exorcist dist/geojson-popup.js.map | _unc > dist/geojson-popup.js",
"uglify": "uglifyjs dist/geojson-popup.js --comments=/^[!]/ -mco dist/geojson-popup.min.js",
"copy-env": "cp -n .env-example.js .env.js",
"start": "node bin/index.js",
"start": "bin/server.js",
"envjslint-ci": "node bin/envjslint.js",
"envjslint": "cat .env.js | pcregrep -M '{\\n.*\\n.*\\n}' | jsonlint-cli",
"jsonlint": "jsonlint-cli data/*",
"test": "eslint src/*.js bin/*.js !.env.js"
"test": "semistandard && eslint index.js src/*.js bin/*.js !.env.js"
},
"eslintConfig": {
"parserOptions": { "ecmaVersion": 6 },
"__env": {
"browser": true
"parserOptions": {
"ecmaVersion": 6
},
"env": {
"node": true
},
"globals": {

@@ -54,3 +72,6 @@ "window": false

}
},
"semistandard": {
"ignore": "dist/"
}
}
[![Build status: Travis-CI][travis-icon]][travis-ci]
[![Build status — Travis-CI][travis-icon]][travis]
[![geojson-popup on Npmjs][npm-icon]][npm]
[![js-semistandard-style][semi-icon]][semi]
[![License][license-icon]][mit]
[![Total downloads - NPMJS.com][downl-icon]][npm]
# popup-geojson-map.js
Add GeoJSON-based templated popups to a Leaflet map. See the audio-player example(s).
# nfreear / geojson-popup
Add GeoJSON-based templated popups to a [Leaflet][] map. See the audio-player example(s).
Easily create interactive maps, with popups containing structured data, for example, audio players.
Software & specs:
* [GeoJSON][]
* [Leaflet.JS][]
* [Lodash][] or [Underscore.js][]
* [SuperAgent][]
Map tiles:
* [Leaflet providers][prov] — _default / free._
* [Mapbox][]
* [National Library of Scotland - Historic Maps][NLS]
Example data & audio files:
* [Freesound][]
* [Commons][]
## Rename
popup-geojson-map
geojson-popup
json-map-popup
I'm renaming the NPM package from `popup-geojson-map` to the clearer `geojson-popup`.
(I'll probably re-name the GitHub repo. too.) Sorry for any hassle!
## Build & test
```sh
npm i popup-geojson-map
git clone https://github.com/nfreear/popup-geojson-map geojson-popup
cd geojson-popup
npm install && npm run build && npm test
npm start
npm test
```

@@ -44,2 +26,4 @@

HTML containing a template, with placeholders, `title` and `audio_url`
```html

@@ -55,8 +39,9 @@ <p id="mapid"></p>

<script> MAP_CFG = { geoJson: 'data/world-audio-geo.json' } </script>
<script> MAP_CFG = { geoJson: '{cdn}/data/world-audio-geo.json' } </script>
<script src="https://unpkg.com/popup-geojson-map@1.1.0-beta#..js"></script>
<script src="https://unpkg.com/geojson-popup@2.0.0-beta#._.js"></script>
```
GeoJSON:
GeoJSON, with properties corresponding to the template placeholders, `title` and `audio_url`:
```json

@@ -78,6 +63,28 @@ "features": [

---
Software & specs:
* [GeoJSON][]
* [Leaflet][]
* [Lodash.template][] - _bundled_
* [SuperAgent][] - _bundled_
Map tiles:
* [Leaflet providers][prov] — _default / free._
* [Mapbox][]
* [National Library of Scotland - Historic Maps][NLS]
Sources for example data & audio files:
* [Freesound][]
* [Commons][]
## Rename
I'm renaming the NPM package from [`popup-geojson-map`][npm-old] to the clearer [`geojson-popup`][npm].
(I'll probably re-name the GitHub repo. too.) _Sorry for any hassle!_
---
* NPM: [popup-geojson-map][npm]
* NPM: [geojson-popup][npm]
* GitHub: [nfreear/popup-geojson-map][]

@@ -92,4 +99,5 @@ * Gist: [nfreear/fd10..][gist]

[travis-icon]: https://travis-ci.org/nfreear/popup-geojson-map.svg
[travis-ci]: https://travis-ci.org/nfreear/popup-geojson-map "Build status – Travis-CI"
[npm]: https://npmjs.com/package/popup-geojson-map
[travis]: https://travis-ci.org/nfreear/popup-geojson-map "Build status – Travis-CI"
[npm-old]: https://npmjs.com/package/popup-geojson-map
[npm]: https://npmjs.com/package/geojson-popup
[nfreear/popup-geojson-map]: https://github.com/nfreear/popup-geojson-map

@@ -101,3 +109,3 @@ [gist]: https://gist.github.com/nfreear/fd1005a2af7a8166862011b8fcb8a821 "Original JS"

[GeoJSON]: http://geojson.org/
[Leaflet.JS]: http://leafletjs.com/examples/geojson.html
[Leaflet]: http://leafletjs.com/examples/geojson.html
[SuperAgent]: https://visionmedia.github.io/superagent/

@@ -114,2 +122,9 @@ [Superagent-X]: http://smalljs.org/ajax/superagent/

[semi]: https://github.com/Flet/semistandard
[semi-icon]: https://img.shields.io/badge/code_style-semistandard-brightgreen.svg
"Javascript coding style — 'semistandard'"
[npm-icon]: https://img.shields.io/npm/v/geojson-popup.svg "Latest version ~ on NPM"
[license-icon]: https://img.shields.io/npm/l/geojson-popup.svg
[downl-icon]: https://img.shields.io/npm/dt/geojson-popup.svg "Count of total downloads ~NPM"
[end]: //end

@@ -7,4 +7,3 @@ /*!

(function (W) {
module.exports = function (WIN, superagent, lodashish, VERSION) {
'use strict';

@@ -16,3 +15,3 @@

minZoom: 2,
maxZoom: 12, //Was: 6, 18,
maxZoom: 12, // Was: 6, 18,
opacity: 1,

@@ -23,3 +22,3 @@ mapId: 'mapid',

checkProperty: 'audio_url',
geoJson: '../data/world-audio-geo.json',
geoJson: '{cdn}/data/world-audio-geo.json',
tileUrl: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',

@@ -33,12 +32,16 @@ attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>',

// attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
lodashish: true,
cdn: 'https://unpkg.com/geojson-popup@' + VERSION, // Was: '@1.1.0-beta'
accessToken: '<%= ENV.ACCESS_TOKEN %>' // No access token required for OpenStreetMap!
};
var JSON = W.JSON // Derive "globals".
, request = W.superagent
, L = W.L // Leaflet
, _ = W._ // Lodash, or Underscore.js
, CFG = _.extend(defaults, W.MAP_CFG)
;
var W = WIN || window;
var JSON = W.JSON;
var L = W.L;
var request = superagent;
var CFG = lodashish.extend(defaults, W.MAP_CFG); // Order is significant!
var _ = CFG.lodashish ? lodashish : W._;
CFG.version = VERSION;
if (typeof CFG.popupTemplate === 'string') {

@@ -50,9 +53,8 @@ CFG.popupTemplate = W.document.querySelector(CFG.popupTemplate).innerText;

var mymap = L.map(CFG.mapId).setView(CFG.latLng, CFG.zoom)
, popup_template = _.template(CFG.popupTemplate, null, CFG.templateSettings)
, accessToken = _.template(CFG.accessToken)
;
var mymap = L.map(CFG.mapId).setView(CFG.latLng, CFG.zoom);
var popupTemplateFn = _.template(CFG.popupTemplate, null, CFG.templateSettings);
var accessToken = _.template(CFG.accessToken);
L.tileLayer(CFG.tileUrl, {
subdomains: CFG.subdomains,
subdomains: CFG.subdomains,
attribution: CFG.attribution,

@@ -66,25 +68,22 @@ maxZoom: CFG.maxZoom,

request
.get(CFG.geoJson)
.get(lodashish.cdn(CFG))
.then(function (response) {
var geoData = JSON.parse(response.text);
var geo_data = JSON.parse(response.text);
W.console.debug('GeoJSON:', geoData);
W.console.debug('GeoJSON:', geo_data);
L.geoJson(geo_data, {
onEachFeature: function (feature, layer) {
if (feature.properties && feature.properties[ CFG.checkProperty ]) {
layer.bindPopup(popup_template(feature.properties));
}
else if (feature.properties && feature.properties.popupContent) {
L.geoJson(geoData, {
onEachFeature: function (feature, layer) {
if (feature.properties && feature.properties[ CFG.checkProperty ]) {
layer.bindPopup(popupTemplateFn(feature.properties));
} else if (feature.properties && feature.properties.popupContent) {
layer.bindPopup(feature.properties.popupContent);
}
}
}
}).addTo(mymap);
}, function (error) {
W.console.error('Superagent HTTP error.', error);
W.alert('HTTP error. ' + error);
});
}(window));
}).addTo(mymap);
},
function (error) {
W.console.error('Superagent HTTP error.', error, CFG.geoJson);
// W.alert('HTTP error. ' + error);
});
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc