Comparing version 0.1.2 to 0.1.3
@@ -24,3 +24,3 @@ const utils = require('./src/utils') | ||
.then(res => { | ||
resolve(utils.soilTypeHtmlParsing(res)) | ||
resolve(utils.soilTypeHtmlParsing(res,5)) | ||
}) | ||
@@ -47,3 +47,3 @@ .catch(error => { | ||
port: 443, | ||
path: `/wms/boden/bodeneigenschaften/?&REQUEST=GetFeatureInfo&SERVICE=WMS&CRS=EPSG%3A3857&STYLES=default&TRANSPARENT=true&VERSION=1.3.0&FORMAT=image%2Fpng&BBOX=${utils.createBBox(geometry)}&HEIGHT=880&WIDTH=514&LAYERS=1&QUERY_LAYERS=1&INFO_FORMAT=text%2Fhtml&I=452&J=371`, | ||
path: `/wms/boden/humus1000ob/?&REQUEST=GetFeatureInfo&SERVICE=WMS&CRS=EPSG%3A3857&STYLES=default&TRANSPARENT=true&VERSION=1.3.0&FORMAT=image%2Fpng&BBOX=${utils.createBBox(geometry)}&HEIGHT=880&WIDTH=514&LAYERS=0&QUERY_LAYERS=0&INFO_FORMAT=text%2Fhtml&I=452&J=371`, | ||
method: 'GET' | ||
@@ -54,3 +54,3 @@ } | ||
.then(res => { | ||
resolve(utils.soilTypeHtmlParsing(res)) | ||
resolve(utils.soilTypeHtmlParsing(res,3)) | ||
}) | ||
@@ -57,0 +57,0 @@ .catch(error => { |
{ | ||
"name": "bgr-apis", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Soil quality API covering Germany with data from BGR", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -48,7 +48,7 @@ let proj4 = require('proj4') | ||
soilTypeHtmlParsing(html) { | ||
soilTypeHtmlParsing(html, cell) { | ||
const parser = new DomParser() | ||
const element = parser.parseFromString(html, 'text/html') | ||
if (element.getElementsByTagName('td')[5]) { | ||
return element.getElementsByTagName('td')[5].innerHTML | ||
if (element.getElementsByTagName('td')[cell]) { | ||
return element.getElementsByTagName('td')[cell].innerHTML | ||
} else { | ||
@@ -55,0 +55,0 @@ return noInfo |
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 ] ] ] } } | ||
/* | ||
// Test soil quality for given point as GeoJSON | ||
@@ -67,3 +64,3 @@ bgr.sqr({ | ||
}) | ||
*/ | ||
// soil type for point | ||
@@ -81,3 +78,3 @@ bgr.soilType({ | ||
/* | ||
// soil type for point given as array | ||
@@ -100,2 +97,1 @@ bgr.soilType([6.9977272,50.778018]) | ||
}) | ||
*/ |
15487
303