Created
September 18, 2014 20:34
-
-
Save morganherlocker/91d54c1f8aa725006c38 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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 | |
| var y = topLeft[1] + g.y | |
| var bbox = tilebelt.tileToBBOX([x,y,zoomEncoding]) | |
| var lon = (bbox[0] + bbox[2])/2 | |
| var lat = (bbox[1] + bbox[3])/2 | |
| this.update([lon,lat]); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment