Random cool stuff I've been hacking on (mostly spatial indices)

Random cool stuff I've been hacking on (mostly spatial indices)

JSGeo 2017, August 15th


Vladimir Agafonkin

August 15, 2017


  1. hello, friends!

  2. None
  3. random cool stuff I’ve been hacking on JSGeo, August 15th

    2017 Vlad (mostly spatial indices)
  4. github.com/mourner/rbush

  5. box queries

  6. finding nearest neighbors

  7. None
  8. None
  9. None
  10. None
  11. • rendering and querying shapes in OpenLayers • processing shapes

    in MapShaper • placing labels and handling annotations in iD OpenStreetMap editor • interactive plotting in Bokeh real time apps
  12. • deriving road speed profiles and live traffic from telemetry

    data • deriving lane geometry, turn restrictions, one-way roads, sidewalks from telemetry data • detecting and fixing issues in OSM data • comparing road networks (e.g. OSM vs TIGER) map matching / processing
  13. map matching / processing • matching Wikidata against OSM for

    geocoding • TurfJS modules like line-intersect, line-split, line- overlap, dissolve, mask, collect • matching features against polygons (e.g. administrative classification) • concaveman: generating an outline of a point set
  14. github.com/mapbox/tile-reduce

  15. osmlab.github.io/osm-qa-tiles

  16. tile-reduce

  17. which polygon?

  18. github.com/mapbox/which-polygon

  19. github.com/mapbox/linematch

  20. buffer, union, difference: slow

  21. github.com/mapbox/linematch freaking fast

  22. github.com/mapbox/lineclip freaking fast

  23. github.com/mourner/rbush-knn

  24. distance from a point to a bounding box

  25. distance from a segment to a bounding box

  26. github.com/mapbox/concaveman

  27. github.com/mapbox/concaveman

  28. github.com/mourner/kdbush

  29. github.com/mourner/kdbush •supports points only (not boxes) •can’t add/remove points dynamically

    •indexing is 5–8 times faster
  30. github.com/mapbox/supercluster

  31. github.com/mapbox/supercluster

  32. None
  33. geodesic nearest neighbors?

  34. distance from a point to a bounding box on a

  35. bbox on a sphere

  36. None
  37. convert to 3D coords?

  38. convert to 3D coords? •can’t use the same index for

    bounding box queries •imprecise for bigger distances •indexing and querying can be slow
  39. None
  40. None
  41. None
  42. when you found a use for differential math for the

    first time in a 13-year career
  43. github.com/mourner/geokdbush

  44. measuring distances fast

  45. measuring distances fast

  46. euclidean geometry with lat/lon

  47. euclidean geometry with lat/lon

  48. github.com/mapbox/cheap-ruler •distance •bearing •destination •lineDistance •area •along •pointOnLine •lineSlice •lineSliceAlong

    •bufferPoint •bufferBBox •insideBBox freaking fast!
  49. github.com/mapbox/earcut

  50. github.com/mapbox/delaunator

  51. github.com/mapbox/alpha-shake coming soon…

  52. github.com/mapbox/polysnap coming soon… my long-time nemesis

  53. github.com/mapbox/geobuf GeoJSON <–> compact binary lossless & freaking fast!

  54. github.com/mapbox/webgl-wind

  55. awesome job alert: GL Map Rendering Engineer grnh.se/7g6l4h1