So I took a few minutes to play with the combination of Bing Maps and Turf and I found it as a perfect match. With just six lines of code I:
- created a random linestring with turf (perfect for testing)
- buffered the linestring.
- calculated the map extent
- added some styling
- added the buffer
- focus the map to the extent and added some padding.
const lineString = turf.randomLineString(1, {bbox: [15, 61, 18, 63],
num_vertices: 10, max_length: 0.5});
let lineBuffer = turf.buffer(lineString, 0.8);
const bbox = turf.bbox(lineBuffer);
lineBuffer.features[0].properties = {color: "rgba(0, 255, 255, 0.7)",
outlineColor: "blue"};
map.addPolygons([lineBuffer.features[0]]);
map.setCameraBounds({bounds: bbox, padding: 100});
That's it! This could have been an difficult operation. It is not - thanks to standard formats, people and organisations adapting it.
One thing I like with Turf and Bing Maps is the ability to generate test data. In Turf it's a bit hidden in the Random section, for example randomLineString.
The industry is starting to gather around GeoJSON. At least leading players such as Micrsoft and MapBox who is also backing Turf.
When will there be a binary standard format with the same adaption as GeoJSON ? Maybe GeoBuf?