osmtogeojson
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -0,1 +1,6 @@ | ||
1.4.0 | ||
----- | ||
* fix various speed bottlenecks (xml parsing, geojson construction, …) | ||
* better performance when handling large xml files with the cli tool: ![](https://f.cloud.github.com/assets/1927298/1461813/4a1ce53e-44ce-11e3-9a96-d600eb3aba9b.png) | ||
1.3.1 | ||
@@ -2,0 +7,0 @@ ----- |
@@ -116,4 +116,2 @@ if (typeof require !== "undefined") { | ||
function _overpassJSON2geoJSON(json) { | ||
// create copy of json to make sure the original object doesn't get altered | ||
json = JSON.parse(JSON.stringify(json)); | ||
// sort elements | ||
@@ -123,12 +121,21 @@ var nodes = new Array(); | ||
var rels = new Array(); | ||
// create copies of individual json objects to make sure the original data doesn't get altered | ||
// todo: cloning is slow: see if this can be done differently! | ||
for (var i=0;i<json.elements.length;i++) { | ||
switch (json.elements[i].type) { | ||
case "node": | ||
nodes.push(json.elements[i]); | ||
var node = _.clone(json.elements[i]); | ||
// todo: this clone could be avoided if we didn't store relations directly within the raw data | ||
// see https://github.com/tyrasd/osmtogeojson/blob/gh-pages/osmtogeojson.js#L298-L302 | ||
nodes.push(node); | ||
break; | ||
case "way": | ||
ways.push(json.elements[i]); | ||
var way = _.clone(json.elements[i]); | ||
way.nodes = _.clone(way.nodes); | ||
ways.push(way); | ||
break; | ||
case "relation": | ||
rels.push(json.elements[i]); | ||
var rel = _.clone(json.elements[i]); | ||
rel.members = _.clone(rel.members); | ||
rels.push(rel); | ||
break; | ||
@@ -135,0 +142,0 @@ default: |
{ | ||
"name": "osmtogeojson", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "convert OSM to geojson", | ||
@@ -29,3 +29,4 @@ "main": "osmtogeojson.js", | ||
"optimist": "~0.3.5", | ||
"concat-stream": "~1.0.1" | ||
"concat-stream": "~1.0.1", | ||
"htmlparser2": "~3.0.5" | ||
}, | ||
@@ -32,0 +33,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104507
11
3276
5
+ Addedhtmlparser2@~3.0.5
+ Addedcore-util-is@1.0.3(transitive)
+ Addeddomelementtype@1.3.1(transitive)
+ Addeddomhandler@2.0.3(transitive)
+ Addeddomutils@1.1.6(transitive)
+ Addedhtmlparser2@3.0.5(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedstring_decoder@0.10.31(transitive)