geojson2svg
Advanced tools
Comparing version 1.2.8 to 1.2.9
157
CHANGELOG.md
@@ -1,12 +0,157 @@ | ||
### Change Log | ||
# Changelog | ||
#### 1.0.0, 2015-04-28 | ||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
* Default viewport size option added [#9](https://github.com/gagan-bansal/geojson2svg/issues/9) | ||
### [1.2.9](https://github.com/gagan-bansal/geojson2svg/compare/v1.2.8...v1.2.9) (2021-11-27) | ||
#### 0.1.0, 2014-09-22 | ||
### Changelog | ||
* Default output as svg string [#4](https://github.com/gagan-bansal/geojson2svg/issues/4) | ||
All notable changes to this project will be documented in this file. Dates are displayed in UTC. | ||
* Default maps extent as of Web Mercator [#3](https://github.com/gagan-bansal/geojson2svg/issues) | ||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). | ||
#### [v1.2.8](https://github.com/gagan-bansal/geojson2svg/compare/v1.2.7...v1.2.8) | ||
> 17 September 2021 | ||
- Basic example added [`8dc4d73`](https://github.com/gagan-bansal/geojson2svg/commit/8dc4d73d3abd8bf8e27a272f67a06a1091437b85) | ||
#### [v1.2.7](https://github.com/gagan-bansal/geojson2svg/compare/v1.2.6...v1.2.7) | ||
> 13 August 2021 | ||
- pan zoom example added [`d70c4d4`](https://github.com/gagan-bansal/geojson2svg/commit/d70c4d4e2434f5b37aae8251ea24e4d1f26a8ee5) | ||
- Bump path-parse from 1.0.6 to 1.0.7 [`6a303ef`](https://github.com/gagan-bansal/geojson2svg/commit/6a303ef781edaffa9b1e5b290a0af223c6c1f0aa) | ||
- viewport meta tag added in examples [`6f83bbf`](https://github.com/gagan-bansal/geojson2svg/commit/6f83bbf163070c49da92ec7ba9517a4f1bba5c7e) | ||
#### [v1.2.6](https://github.com/gagan-bansal/geojson2svg/compare/v1.2.5...v1.2.6) | ||
> 15 April 2021 | ||
- jsdom (dev dependency) version corrected, all tests passed [`b98a8fe`](https://github.com/gagan-bansal/geojson2svg/commit/b98a8fe4aacc11f17d9824884d74db1ede7e8401) | ||
#### [v1.2.5](https://github.com/gagan-bansal/geojson2svg/compare/v1.2.4...v1.2.5) | ||
> 31 March 2021 | ||
- Scalable SVG map example added [`94e64ac`](https://github.com/gagan-bansal/geojson2svg/commit/94e64ac3f5cec4cfb9990ee02120873b3cbbbd5f) | ||
- blog link changed [`95a2b46`](https://github.com/gagan-bansal/geojson2svg/commit/95a2b46b393a3e1129058413fcd04dca91e7d7b0) | ||
#### [v1.2.4](https://github.com/gagan-bansal/geojson2svg/compare/v1.2.3...v1.2.4) | ||
> 29 March 2021 | ||
- Thanks @psohm [`#24`](https://github.com/gagan-bansal/geojson2svg/pull/24) | ||
- updated dev-dependency that fixes npm audit [`61bbec8`](https://github.com/gagan-bansal/geojson2svg/commit/61bbec89414db67e1de6e862616a239608eda9e5) | ||
- Update README.md [`67f892d`](https://github.com/gagan-bansal/geojson2svg/commit/67f892dacb9a61f7e8aea0848e0daa44b357c950) | ||
#### [v1.2.3](https://github.com/gagan-bansal/geojson2svg/compare/v1.2.2...v1.2.3) | ||
> 27 November 2017 | ||
- Update README.md [`#19`](https://github.com/gagan-bansal/geojson2svg/pull/19) | ||
- dev dependency uglify-js updated [`4c2d7b0`](https://github.com/gagan-bansal/geojson2svg/commit/4c2d7b051af09eb979c8ed2c91b67fd17fdb8211) | ||
#### [v1.2.2](https://github.com/gagan-bansal/geojson2svg/compare/v1.2.1...v1.2.2) | ||
> 16 June 2017 | ||
- README updated to show parse-svg usage [`de6633d`](https://github.com/gagan-bansal/geojson2svg/commit/de6633d855dd0dcf7b21c2c7c8a917d56df49247) | ||
#### [v1.2.1](https://github.com/gagan-bansal/geojson2svg/compare/v1.2.0...v1.2.1) | ||
> 16 May 2017 | ||
- Fixed bug of variable declaration [`ce719b8`](https://github.com/gagan-bansal/geojson2svg/commit/ce719b8befb114e8a5d65de8ca78fc6bae093456) | ||
#### [v1.2.0](https://github.com/gagan-bansal/geojson2svg/compare/v1.1.0...v1.2.0) | ||
> 8 May 2017 | ||
- option attributes as dynamic and static [`#17`](https://github.com/gagan-bansal/geojson2svg/issues/17) | ||
#### [v1.1.0](https://github.com/gagan-bansal/geojson2svg/compare/v1.0.6...v1.1.0) | ||
> 5 May 2017 | ||
- attributes option enhanced [`77f4365`](https://github.com/gagan-bansal/geojson2svg/commit/77f43652a82c1084b7355513c34fd311ffa0ea29) | ||
- Dist created [`3b4152d`](https://github.com/gagan-bansal/geojson2svg/commit/3b4152d2cf8a6f44ee23cf628fb4d29f876b7deb) | ||
#### [v1.0.6](https://github.com/gagan-bansal/geojson2svg/compare/v1.0.5...v1.0.6) | ||
> 15 February 2017 | ||
- Point as SVG Circle but fixes #15 [`#15`](https://github.com/gagan-bansal/geojson2svg/issues/15) | ||
#### [v1.0.5](https://github.com/gagan-bansal/geojson2svg/compare/v1.0.4...v1.0.5) | ||
> 22 November 2016 | ||
- dev dependency jsdom ver update [`01bf72d`](https://github.com/gagan-bansal/geojson2svg/commit/01bf72d42a5f603454a3affd1676efa03d64c458) | ||
#### [v1.0.4](https://github.com/gagan-bansal/geojson2svg/compare/v1.0.3...v1.0.4) | ||
> 8 November 2016 | ||
- updated dependent deepmerge, fixes #12 issue [`#12`](https://github.com/gagan-bansal/geojson2svg/issues/12) | ||
#### [v1.0.3](https://github.com/gagan-bansal/geojson2svg/compare/v1.0.2...v1.0.3) | ||
> 20 February 2016 | ||
- GeometryCollection typo fixed, also added test case for same, fixes #13 [`#13`](https://github.com/gagan-bansal/geojson2svg/issues/13) | ||
- rebuild [`fdd3d1d`](https://github.com/gagan-bansal/geojson2svg/commit/fdd3d1de2a2e53788128e566246688edf39bf853) | ||
#### [v1.0.2](https://github.com/gagan-bansal/geojson2svg/compare/v1.0.1...v1.0.2) | ||
> 12 August 2015 | ||
- default svg id from feature's properties, close #11 #changelog [`#11`](https://github.com/gagan-bansal/geojson2svg/issues/11) | ||
- merging options from constructor and convert api resolved #10 #changelog [`#10`](https://github.com/gagan-bansal/geojson2svg/issues/10) | ||
- default svg id from feature's properties [`6399359`](https://github.com/gagan-bansal/geojson2svg/commit/63993595c51f717200b1d587bf5f75478cf1dc01) | ||
- rebuild dist [`ec276bb`](https://github.com/gagan-bansal/geojson2svg/commit/ec276bb3ca7bb0f3ae38f5227fb69f672d4ccf87) | ||
- udpate to 1.0.1 for #10 issue [`2fee026`](https://github.com/gagan-bansal/geojson2svg/commit/2fee026a6ed05a0781b204a16e25b711f7717f82) | ||
#### [v1.0.1](https://github.com/gagan-bansal/geojson2svg/compare/v1.0.0...v1.0.1) | ||
> 29 May 2015 | ||
- merging options from counstructor and convert api resolved #10 #changelog [`#10`](https://github.com/gagan-bansal/geojson2svg/issues/10) | ||
- Default viewport size option added close #9 #changelog [`#9`](https://github.com/gagan-bansal/geojson2svg/issues/9) | ||
- data display at 180 deg resolved #6 [`#6`](https://github.com/gagan-bansal/geojson2svg/issues/6) | ||
- demo map display in chrome resolved #7 [`#7`](https://github.com/gagan-bansal/geojson2svg/issues/7) | ||
- default svg output and web mercator extent close #3, close #4 #changelog [`#3`](https://github.com/gagan-bansal/geojson2svg/issues/3) [`#4`](https://github.com/gagan-bansal/geojson2svg/issues/4) | ||
- color coded map example added [`9e07f97`](https://github.com/gagan-bansal/geojson2svg/commit/9e07f97c292367db8dd998a485de88cc0797d684) | ||
- fit to width/height option added [`362f474`](https://github.com/gagan-bansal/geojson2svg/commit/362f4748feb127132af76f41db4bdf975b54feea) | ||
- color coded map example added [`55b4727`](https://github.com/gagan-bansal/geojson2svg/commit/55b47270e5744b1e64480f8a8c87f5a0581ffce3) | ||
### [v1.0.0](https://github.com/gagan-bansal/geojson2svg/compare/v0.1.4...v1.0.0) | ||
> 28 April 2015 | ||
- Update README.md [`#8`](https://github.com/gagan-bansal/geojson2svg/pull/8) | ||
- Default viewport size option added close #9 #changelog [`#9`](https://github.com/gagan-bansal/geojson2svg/issues/9) | ||
#### [v0.1.4](https://github.com/gagan-bansal/geojson2svg/compare/v0.1.0...v0.1.4) | ||
> 27 April 2015 | ||
- data display at 180 deg resolved #6 [`#6`](https://github.com/gagan-bansal/geojson2svg/issues/6) | ||
- demo map display in chrome resolved #7 [`#7`](https://github.com/gagan-bansal/geojson2svg/issues/7) | ||
- default svg output and web mercator extent close #3, close #4 (correcting the issue number) [`#3`](https://github.com/gagan-bansal/geojson2svg/issues/3) [`#4`](https://github.com/gagan-bansal/geojson2svg/issues/4) | ||
- default svg output and web mercator extent close #4, close #5 [`#4`](https://github.com/gagan-bansal/geojson2svg/issues/4) [`#5`](https://github.com/gagan-bansal/geojson2svg/issues/5) | ||
- color coded map example added [`62732f0`](https://github.com/gagan-bansal/geojson2svg/commit/62732f0195280a64f96fed12d8ece2fece0c848d) | ||
- fit to width/height option added [`0f46d2f`](https://github.com/gagan-bansal/geojson2svg/commit/0f46d2fd25940cb85ca587e9e0ed171a0b89eaf2) | ||
- color coded map example added [`22e471f`](https://github.com/gagan-bansal/geojson2svg/commit/22e471f8861e533b332a6bc841d12c4ffce2cf99) | ||
#### v0.1.0 | ||
> 28 April 2015 | ||
- Default viewport size option added close #9 #changelog [`#9`](https://github.com/gagan-bansal/geojson2svg/issues/9) | ||
- data display at 180 deg resolved #6 [`#6`](https://github.com/gagan-bansal/geojson2svg/issues/6) | ||
- demo map display in chrome resolved #7 [`#7`](https://github.com/gagan-bansal/geojson2svg/issues/7) | ||
- default svg output and web mercator extent close #3, close #4 #changelog [`#3`](https://github.com/gagan-bansal/geojson2svg/issues/3) [`#4`](https://github.com/gagan-bansal/geojson2svg/issues/4) | ||
- initial prototype ready [`4be51ee`](https://github.com/gagan-bansal/geojson2svg/commit/4be51eef9054218d64fd09f01c162b5b06beb94d) | ||
- all test passed , remaining explode [`00ef0bf`](https://github.com/gagan-bansal/geojson2svg/commit/00ef0bf2ae135692ddf28227b40fe144d5ce1509) | ||
- small bugfix and README.md written [`393dc33`](https://github.com/gagan-bansal/geojson2svg/commit/393dc3337c0106ec154e81b649b92b3ea7143be1) |
{ | ||
"name": "geojson2svg", | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"description": "Converts geojson to svg/path string given svg viewport size and maps extent.", | ||
@@ -11,2 +11,4 @@ "main": "src/main.js", | ||
"build": "npm run build-debug && npm run build-min", | ||
"rebuild-changelog": "auto-changelog", | ||
"release": "standard-version", | ||
"watch": "watchify src/main.js --debug --standalone geojson2svg -o dist/geojson2svg.js -v" | ||
@@ -29,2 +31,3 @@ }, | ||
"devDependencies": { | ||
"auto-changelog": "^2.3.0", | ||
"browserify": "~17.0.0", | ||
@@ -34,5 +37,6 @@ "chai": "~4.3.4", | ||
"exorcist": "^2.0.0", | ||
"jsdom": "^9.8.3", | ||
"mocha": "~8.3.2", | ||
"jsdom": "^18.1.1", | ||
"mocha": "^9.1.3", | ||
"parse-svg-path": "~0.1.2", | ||
"standard-version": "^9.3.2", | ||
"uglify-js": "^3.13.3", | ||
@@ -39,0 +43,0 @@ "watchify": "^4.0.0" |
@@ -7,5 +7,6 @@ 'use strict'; | ||
var testData = require('./testdata.js'); | ||
var expect = require('chai').expect | ||
,parsePath = require('parse-svg-path') | ||
,jsdom = require('jsdom').jsdom; | ||
var expect = require('chai').expect; | ||
var parsePath = require('parse-svg-path'); | ||
var jsdom = require('jsdom'); | ||
var {JSDOM} = jsdom; | ||
@@ -37,3 +38,3 @@ describe('geojson2svg', function() { | ||
expect(actualSVGs.length).to.be.equal(1); | ||
var actSVGEle = jsdom(actualSVGs).firstChild.children[1].children[0]; | ||
var actSVGEle = string2dom(actualSVGs); | ||
expect(actSVGEle.nodeName).to.be.equal('CIRCLE'); | ||
@@ -101,5 +102,5 @@ expect(actSVGEle.hasAttribute('cx')) | ||
}); | ||
it('Polygon fit to width', function() { | ||
it('Polygon fit to width', function() { | ||
var converter2 = geojson2svg( | ||
{ | ||
{ | ||
viewportSize: {width: 300, height: 100}, | ||
@@ -123,6 +124,6 @@ mapExtent: {left: -180, bottom: -90, right: 180, top: 90}, | ||
var actualOutput = converter.convert(testData['Default values'].geojson); | ||
testSVG(actualOutput, testData['Default values'].svg, | ||
testSVG(actualOutput, testData['Default values'].svg, | ||
testData['Default values'].geojson.type, precision); | ||
}); | ||
it('add attributes to svg based on each feature properties:', function() { | ||
@@ -134,7 +135,7 @@ var converter = geojson2svg( | ||
features: [{ | ||
type: 'Feature', | ||
type: 'Feature', | ||
geometry: {type: 'LineString', coordinates: [[0,0], [1000,1000]]}, | ||
properties: {foo: 'fooVal-1', bar: 'barVal-1', baz: 'bazVal-1'} | ||
}, { | ||
type: 'Feature', | ||
type: 'Feature', | ||
geometry: {type: 'LineString', coordinates: [[10,10], [100,100]]}, | ||
@@ -145,3 +146,3 @@ properties: {foo: 'fooVal-2', bar: 'barVal-2'} | ||
var svgEle1 = jsdom(svgStr[0]).firstChild.children[1].children[0]; | ||
var svgEle1 = string2dom(svgStr[0]); | ||
expect(svgEle1).to.respondTo('getAttribute'); | ||
@@ -152,3 +153,3 @@ expect(svgEle1.getAttribute('foo')).to.be.equal('fooVal-1'); | ||
var svgEle2 = jsdom(svgStr[1]).firstChild.children[1].children[0]; | ||
var svgEle2 = string2dom(svgStr[1]); | ||
expect(svgEle2).to.respondTo('getAttribute'); | ||
@@ -179,7 +180,7 @@ expect(svgEle2.getAttribute('foo')).to.be.equal('fooVal-2'); | ||
features: [{ | ||
type: 'Feature', | ||
type: 'Feature', | ||
geometry: {type: 'LineString', coordinates: [[0,0], [1000,1000]]}, | ||
properties: {foo: 'fooVal-1', bar: 'barVal-1', baz: 'bazVal-1'} | ||
}, { | ||
type: 'Feature', | ||
type: 'Feature', | ||
geometry: {type: 'LineString', coordinates: [[10,10], [100,100]]}, | ||
@@ -189,3 +190,3 @@ properties: {foo: 'fooVal-2', bar: 'barVal-2'} | ||
}) | ||
var svgEle1 = jsdom(svgStr[0]).firstChild.children[1].children[0]; | ||
var svgEle1 = string2dom(svgStr[0]); | ||
expect(svgEle1).to.respondTo('getAttribute'); | ||
@@ -197,3 +198,3 @@ expect(svgEle1.getAttribute('id')).to.be.equal('fooVal-1'); | ||
var svgEle2 = jsdom(svgStr[1]).firstChild.children[1].children[0]; | ||
var svgEle2 = string2dom(svgStr[1]); | ||
expect(svgEle2).to.respondTo('getAttribute'); | ||
@@ -206,3 +207,3 @@ expect(svgEle2.getAttribute('id')).to.be.equal('fooVal-2'); | ||
it('add given attributes in options to all svg elements: ' | ||
it('add given attributes in options to all svg elements: ' | ||
+ 'pass attributes in constructor', function() { | ||
@@ -212,3 +213,3 @@ var converter = geojson2svg({attributes: {class: 'foo'}}); | ||
{type:'LineString', coordinates: [[0,0], [1000,1000]]}); | ||
var outputEle = jsdom(output).firstChild.children[1].children[0]; | ||
var outputEle = string2dom(output); | ||
expect(outputEle).to.respondTo('getAttribute'); | ||
@@ -224,3 +225,3 @@ expect(outputEle.getAttribute('class')).to.be.equal('foo'); | ||
); | ||
var outputEle = jsdom(output).firstChild.children[1].children[0]; | ||
var outputEle = string2dom(output); | ||
expect(outputEle).to.respondTo('getAttribute'); | ||
@@ -237,3 +238,3 @@ expect(outputEle.getAttribute('class')).to.be.equal('foo'); | ||
}); | ||
var outputEle = jsdom(output).firstChild.children[1].children[0]; | ||
var outputEle = string2dom(output); | ||
expect(outputEle).to.respondTo('getAttribute'); | ||
@@ -250,3 +251,3 @@ expect(outputEle.getAttribute('class')).to.be.equal('foo'); | ||
}); | ||
var outputEle = jsdom(output).firstChild.children[1].children[0]; | ||
var outputEle = string2dom(output); | ||
expect(outputEle).to.respondTo('getAttribute'); | ||
@@ -264,4 +265,4 @@ expect(outputEle.getAttribute('class')).to.be.equal('foo'); | ||
//for(var i=0;i<expSVGs.length; i++) { | ||
expSVGEle = jsdom(expSVGs).firstChild.children[1].children[0]; | ||
actSVGEle = jsdom(actualSVGs).firstChild.children[1].children[0]; | ||
expSVGEle = string2dom(expSVGs); | ||
actSVGEle = string2dom(actualSVGs); | ||
expect(actSVGEle.nodeName).to.be.equal('PATH'); | ||
@@ -304,1 +305,5 @@ expect(actSVGEle.hasAttribute('d')).to.be.true; | ||
} | ||
function string2dom (str) { | ||
return (new JSDOM(str)).window.document.body.firstChild | ||
} |
456823
3927
11