-
find max and min vertex y of polygon
-
get tile of max vertex for max_zoom
-
get intersections of a horizontal line at the tile's y value across the polygon
-
add tiles from the first intersection (far left) to intersection + 1 (use tilebelt.pointToTile, which is fast)
-
go to intersection + 2 and repeat [4] until there are no intersections left (this would skip over holes and caves)
| var tilebelt = require('tilebelt'); | |
| var domify = require('domify'); | |
| var z = getBboxZoom([100, 0, 101, 2]) | |
| document.body.appendChild(domify('<p>z:'+z)); | |
| function getBboxZoom(bbox) { | |
| var MAX_ZOOM = 28; |
| var domify = require('domify'); | |
| document.body.appendChild(domify('<p>yep')); |
| var building = {} | |
| building.properties = vt.layers.building.feature(i).properties; | |
| building.geometry = vt.layers.building.feature(i).loadGeometry(); | |
| traverse(building.geometry).forEach(function(g){ | |
| if(!Array.isArray(g) && typeof g.x === 'number') { | |
| var topLeft = tile; | |
| while(topLeft[2] < zoomEncoding){ | |
| topLeft = tilebelt.getChildren(topLeft)[0] | |
| } | |
| var x = topLeft[0] + g.x |
| # address interpolation - noop[K | |
| ok [1m[32m1[0m should be equivalent[K | |
| ok [1m[32m2[0m should be equivalent[K | |
| ok [1m[32m3[0m should be equivalent[K | |
| [1A[1G[1m[32m✓ address interpolation - noop[0m[1B[1G | |
| # address interpolation - parity: even + both[K | |
| ok [1m[32m4[0m should be equivalent[K | |
| [1A[1G[1m[32m✓ address interpolation - parity: even + both[0m[1B[1G |
- merge scanline refactor with master
- explore scanline
- explore 2 split
When you make an async request to a server, you fire it off and wait for the server to respond. The server could respond to multiple requests in any order it likes. If you are working on something that needs to be in order, there are a few things that you can do to control the flow.
The most basic approach involves counting up responses outside of callbacks until the number of responses === the number of requests. This works, but can get crazy if you have a lot of complex events flying around everywhere.
var urls = [...]
var pages = []
for(var i = 0; i < urls.length; i++) {v1 spec that hit a wall due to me having my numbers of a bit (performance was impractical)
-
tiles are processed and put into a leveldb store
-
downloaded tiles are cached
-
each z15 vector tile's geometry is encoded as z25 tile voxel equivalents
tape is a tiny test runner and assertion library. It outputs a text format called TAP (Test Anything Protocol). TAP is cool because it is a standardized text format that can be easily parsed in just about any programming language. Unlike many other javascript test frameworks, tape is a simple npm module, so it can be run anywhere without weird hacks.
###Installation
npm install tape --save-dev| TAP version 13 | |
| # the world | |
| party in ===============================> AFG.geo.json | |
| ok 1 check tile-cover | |
| ok 2 check for empty tiles | |
| ok 3 check for empty tiles | |
| ok 4 check for empty tiles | |
| ok 5 check for empty tiles | |
| ok 6 check for empty tiles | |
| ok 7 check for empty tiles |
