- Contributor: @morganherlocker
- Task: Hausdorf Distance
- Issue: Turfjs/turf#1286
- Estimated Time: 5 hours
- Deadline: 3/10/18
- Requested Budget: $50
- Impact: Allows you to compare the similarity between two lines to find the most similar in a Collection or Set of lines.
View feature.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"distance": 0.04162350800625099, | |
"curve": 0.009039173454286032, | |
"oneway=yes": 1.0, | |
"highway=trunk_link": 0.0, | |
"highway=primary": 0.0, | |
"lanes=2": 0.0, | |
"maxspeed=35 mph": 0.0, | |
"lanes=3": 0.0, | |
"highway=secondary": 0.0, |
View bounty-example.md
View readme.md
cat line-delimitted-geo-data.json | node to-collection.js > valid-geojson.json
View quad-to-geojson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSON.stringify(require('tilebelt').tileToGeoJSON(require('tilebelt').quadkeyToTile('1231002'))) |
View geojson-transform-stream.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var through2 = require('through2') | |
var byline = require('byline') | |
process.stdin | |
.pipe(byline.createStream()) | |
.pipe(through2(function(chunk, enc, next){ | |
var data = JSON.parse(chunk.toString()) | |
this.push(toGeoJSON(data)) |
View doublestream.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var through2 = require('through2') | |
var fs = require('fs') | |
var byline = require('byline') | |
var combine = through2(function(chunk, enc, next){ | |
console.log(chunk.toString()) | |
console.log('--') | |
next() | |
}) |
View largest-hulls.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fc = // ... a featurecollection of polygons and multipolygons | |
var polys = turf.featurecollection([]) | |
fc.features.forEach(function(poly){ | |
if (poly.geometry.type === 'Polygon') { | |
polys.features.push(poly) | |
} else if (poly.geometry.type === 'MultiPolygon') { | |
// start max area at -Infinity | |
var max = { |
View tile-out.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cover = require('tile-cover') | |
var tilebelt = require('tilebelt') | |
var turf = require('@turf/turf') | |
var features = [ | |
{ | |
"type": "Feature", | |
"properties": {}, | |
"geometry": { | |
"type": "Point", |
View not-inside-quick.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pts = // my point featurecollection | |
var polys = // my poly featurecollection | |
var tree = rbush() | |
polys.features.forEach(function(poly, i){ | |
var bbox = turf.bbox(poly) | |
var idx = { | |
minX: bbox[0], | |
minY: bbox[1], |
View inside-filter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pts = // my point featurecollection | |
var polys = // my poly featurecollection | |
pts.features = pts.features.filter(function(pt){ | |
var isInside = false | |
polys.features.forEach(function(poly){ | |
if(turf.inside(pt, poly)) isInside = true | |
}) | |
return isInside | |
}) |
NewerOlder