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

bgr-apis

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bgr-apis - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

LICENSE.md

4

.eslintrc.js

@@ -13,3 +13,3 @@ module.exports = {

"error",
4
2
],

@@ -29,2 +29,2 @@ "linebreak-style": [

}
};
};

@@ -0,0 +0,0 @@ const utils = require('./src/utils');

{
"name": "bgr-apis",
"version": "0.0.1",
"version": "0.0.2",
"description": "Soil quality API covering Germany with data from BGR",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,0 +0,0 @@ # BGR Soil Information

@@ -1,8 +0,14 @@

const proj4 = require("proj4")
let proj4 = require('proj4')
// hack to ensure compatibilty to ES6 modules from Fruchtfolge main repo
if (proj4.default) {
proj4 = require('proj4').default
}
const DomParser = require('dom-parser')
const https = require('https')
const bbox = require('@turf/bbox').default
const buffer = require('@turf/buffer')
const buffer = require('@turf/buffer').default
const centroid = require('@turf/centroid').default
const noInfo = 'No information available for given query'
module.exports = {

@@ -17,6 +23,7 @@ createBBox(point) {

reprojectionFirst = proj4(fromProjection, toProjection, boundFirst)
reprojectionSecond = proj4(fromProjection, toProjection, boundSecond)
const reprojectionFirst = proj4(fromProjection, toProjection, boundFirst)
const reprojectionSecond = proj4(fromProjection, toProjection, boundSecond)
return bboxString = reprojectionFirst.concat(reprojectionSecond).toString().replace(/,/g, '%2C')
const bboxString = reprojectionFirst.concat(reprojectionSecond).toString().replace(/,/g, '%2C')
return bboxString
},

@@ -26,6 +33,6 @@

const parser = new DomParser()
const element = parser.parseFromString(html, "text/html")
if (element.getElementsByTagName("td").length == 4) {
if (element.getElementsByTagName("td")[3]) {
return Number(element.getElementsByTagName("td")[3].innerHTML)
const element = parser.parseFromString(html, 'text/html')
if (element.getElementsByTagName('td').length == 4) {
if (element.getElementsByTagName('td')[3]) {
return Number(element.getElementsByTagName('td')[3].innerHTML)
} else {

@@ -35,4 +42,4 @@ return noInfo

} else {
if (element.getElementsByTagName("td")[1]) {
return Number(element.getElementsByTagName("td")[1].innerHTML)
if (element.getElementsByTagName('td')[1]) {
return Number(element.getElementsByTagName('td')[1].innerHTML)
} else {

@@ -46,5 +53,5 @@ return noInfo

const parser = new DomParser()
const element = parser.parseFromString(html, "text/html")
if (element.getElementsByTagName("td")[3]) {
return element.getElementsByTagName("td")[3].innerHTML
const element = parser.parseFromString(html, 'text/html')
if (element.getElementsByTagName('td')[3]) {
return element.getElementsByTagName('td')[3].innerHTML
} else {

@@ -61,3 +68,2 @@ return noInfo

} = res
const contentType = res.headers['content-type']

@@ -103,8 +109,8 @@ let error

return {
"type": "Point",
"coordinates": point
}
'type': 'Point',
'coordinates': point
}
}
// when object is passed
} else if (typeof point === 'object') {
// when object is passed
} else if (typeof point === 'object') {
if (point.type === 'Point' && point.coordinates.length === 2) {

@@ -117,3 +123,3 @@ return point

}
// when a string is passed
// when a string is passed
} else {

@@ -120,0 +126,0 @@ return new Error(this.invalidRequest())

const assert = require('assert')
const bgr = require('../index')
const plotGeometry = { "type": "Feature", "properties": { "name": "1", "id": "1" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 8.472359282984609, 52.098940574732026 ], [ 8.472385841011695, 52.09888405181575 ], [ 8.472541458742908, 52.098705607139166 ], [ 8.472664055554583, 52.09858672762726 ], [ 8.472745844081068, 52.098502499839256 ], [ 8.473077777958407, 52.09813594759476 ], [ 8.473632197332014, 52.09814014501764 ], [ 8.475482330304995, 52.0982115903363 ], [ 8.475920404239684, 52.09823183315378 ], [ 8.47742474945971, 52.09823849626592 ], [ 8.47750387554873, 52.09824000139136 ], [ 8.477296712383492, 52.09937612246312 ], [ 8.477214758007113, 52.09936312148708 ], [ 8.47698713952333, 52.09935257892118 ], [ 8.476785502568358, 52.099341574902894 ], [ 8.47600993138795, 52.09932525914868 ], [ 8.475115881120201, 52.09930881547615 ], [ 8.47454397874537, 52.099295856537175 ], [ 8.473916828515828, 52.099281634139224 ], [ 8.473577919894248, 52.09927260230557 ], [ 8.47355993067331, 52.09927213537339 ], [ 8.473389282086671, 52.09926068849093 ], [ 8.473339776614914, 52.09925736729662 ], [ 8.47315219767625, 52.099229937742344 ], [ 8.473015646461512, 52.09920278003861 ], [ 8.47287497373195, 52.099161413412745 ], [ 8.472728963971086, 52.09910728714095 ], [ 8.472552781073777, 52.099026711139864 ], [ 8.472359282984609, 52.098940574732026 ] ] ] } }
const plotGeometry = { 'type': 'Feature', 'properties': { 'name': '1', 'id': '1' }, 'geometry': { 'type': 'Polygon', 'coordinates': [ [ [ 8.472359282984609, 52.098940574732026 ], [ 8.472385841011695, 52.09888405181575 ], [ 8.472541458742908, 52.098705607139166 ], [ 8.472664055554583, 52.09858672762726 ], [ 8.472745844081068, 52.098502499839256 ], [ 8.473077777958407, 52.09813594759476 ], [ 8.473632197332014, 52.09814014501764 ], [ 8.475482330304995, 52.0982115903363 ], [ 8.475920404239684, 52.09823183315378 ], [ 8.47742474945971, 52.09823849626592 ], [ 8.47750387554873, 52.09824000139136 ], [ 8.477296712383492, 52.09937612246312 ], [ 8.477214758007113, 52.09936312148708 ], [ 8.47698713952333, 52.09935257892118 ], [ 8.476785502568358, 52.099341574902894 ], [ 8.47600993138795, 52.09932525914868 ], [ 8.475115881120201, 52.09930881547615 ], [ 8.47454397874537, 52.099295856537175 ], [ 8.473916828515828, 52.099281634139224 ], [ 8.473577919894248, 52.09927260230557 ], [ 8.47355993067331, 52.09927213537339 ], [ 8.473389282086671, 52.09926068849093 ], [ 8.473339776614914, 52.09925736729662 ], [ 8.47315219767625, 52.099229937742344 ], [ 8.473015646461512, 52.09920278003861 ], [ 8.47287497373195, 52.099161413412745 ], [ 8.472728963971086, 52.09910728714095 ], [ 8.472552781073777, 52.099026711139864 ], [ 8.472359282984609, 52.098940574732026 ] ] ] } }

@@ -11,26 +11,26 @@

}, 18)
.then(res => {
assert.deepStrictEqual(res,72)
})
.catch(err => {
console.log(err)
})
.then(res => {
assert.deepStrictEqual(res,72)
})
.catch(err => {
console.log(err)
})
// same point as array
bgr.sqr([6.9977272,50.778018], 18)
.then(res => {
assert.deepStrictEqual(res,72)
})
.catch(err => {
console.log(err)
})
.then(res => {
assert.deepStrictEqual(res,72)
})
.catch(err => {
console.log(err)
})
// testing a plot
bgr.sqr(plotGeometry, 18)
.then(res => {
assert.deepStrictEqual(res,70.5)
})
.catch(err => {
console.log(err)
})
.then(res => {
assert.deepStrictEqual(res,70.5)
})
.catch(err => {
console.log(err)
})

@@ -42,25 +42,25 @@ // soil type for point

})
.then(res => {
assert.deepStrictEqual(res,'Lehmsande (ls)')
})
.catch(err => {
console.log(err)
})
.then(res => {
assert.deepStrictEqual(res,'Lehmsande (ls)')
})
.catch(err => {
console.log(err)
})
// soil type for point given as array
bgr.soilType([6.9977272,50.778018])
.then(res => {
assert.deepStrictEqual(res,'Lehmsande (ls)')
})
.catch(err => {
console.log(err)
})
.then(res => {
assert.deepStrictEqual(res,'Lehmsande (ls)')
})
.catch(err => {
console.log(err)
})
// soil type for point given as plot geometry
bgr.soilType(plotGeometry)
.then(res => {
assert.deepStrictEqual(res,'Tonschluffe (tu)')
})
.catch(err => {
console.log(err)
})
.then(res => {
assert.deepStrictEqual(res,'Tonschluffe (tu)')
})
.catch(err => {
console.log(err)
})
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