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

geojson2svg

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geojson2svg - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

package.json
{
"name": "geojson2svg",
"version": "1.2.1",
"version": "1.2.2",
"description": "Converts geojson to svg/path string given svg viewport size and maps extent.",

@@ -5,0 +5,0 @@ "main": "src/main.js",

@@ -25,3 +25,3 @@ # geojson2svg

var converter = geojson2svg(options);
var svgString = converter.convert(geojson,options);
var svgStrings = converter.convert(geojson,options);
```

@@ -31,5 +31,24 @@ Using in browser standard way

var converter = geojson2svg(options);
var svgString = converter.convert(geojson,options);
var svgStrings = converter.convert(geojson,options);
```
**convert** function returns array of svg element string
Now svg strings can be easily converted to HTML svg elements. Intentionally I have kept the geojson2svg's output as string to make it more modular. Here is simple way to convert svg strings to svg elements with [parse-svg](https://github.com/gagan-bansal/parse-svg) or with any other parser.
```shell
npm isntall parse-svg
```
or include in your html file
```html
<script type="text/javascript" src="path/to/parse-svg.min.js"></script>
```
Simple way to convert svgStrings to svg elements
```javascript
var parseSVG = require('parse-svg')
var svgElements = svgStrings.map(function(svgString) {
return parseSVG(svgString)
})
```
### Options

@@ -112,3 +131,3 @@

```
var svgString = convertor.convert(geojson,
var svgStrings = convertor.convert(geojson,
{

@@ -138,6 +157,6 @@ "attributes": ...,

);
var svgString = converter.convert(
var svgStrings = converter.convert(
{type:'LineString',coordinates:[[10,10],[15,20],[30,10]]}
);
//svgString: ['<path d="M105.55555555555556,44.44444444444444 108.33333333333333,38.888888888888886 116.66666666666666,44.44444444444444" />']
//svgStrings: ['<path d="M105.55555555555556,44.44444444444444 108.33333333333333,38.888888888888886 116.66666666666666,44.44444444444444" />']
```

@@ -144,0 +163,0 @@ Converts geojson Polygon to svg path data 'd' string:

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