Skip to content

Commit

Permalink
Export mapboxgl.addSourceType
Browse files Browse the repository at this point in the history
  • Loading branch information
Anand Thakker committed Aug 24, 2016
1 parent 7063b1a commit f2a3c9d
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
101 changes: 101 additions & 0 deletions debug/custom_source.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">

<link rel='stylesheet' href='/dist/mapbox-gl.css' />
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
#checkboxes {
position: absolute;
background: #fff;
top:0;
left:0;
padding:10px;
}
#buffer {
position: absolute;
top:100px;
left:0;
pointer-events: none;
}
#buffer div {
background-color: #fff;
padding: 5px 0;
text-indent: 10px;
white-space: nowrap;
text-shadow:
-1px -1px 0 #fff,
1px -1px 0 #fff,
-1px 1px 0 #fff,
1px 1px 0 #fff;
}
</style>
</head>

<body>
<div id='map'></div>
<div id='checkboxes'>
<input id='show-tile-boundaries-checkbox' name='show-tile-boundaries' type='checkbox'> <label for='show-tile-boundaries'>tile debug</label><br />
<input id='show-symbol-collision-boxes-checkbox' name='show-symbol-collision-boxes' type='checkbox'> <label for='show-symbol-collision-boxes'>collision debug</label><br />
<input id='show-overdraw-checkbox' name='show-overdraw' type='checkbox'> <label for='show-overdraw'>overdraw debug</label><br />
<input id='buffer-checkbox' name='buffer' type='checkbox'> <label for='buffer'>buffer stats</label>
</div>

<div id='buffer' style="display:none">
<em>Waiting for data...</em>
</div>

<script src='/dist/mapbox-gl-dev.js'></script>
<script src='http://devseed.com/mapbox-gl-topojson/dist/mapbox-gl-topojson.js'></script>
<script src='/debug/access-token-generated.js'></script>

<script>
mapboxgl.workerCount = 1
mapboxgl.addSourceType('topojson', mapboxgl.TopoJSONSource, function (err) {
var map = window.map = new mapboxgl.Map({
container: 'map',
zoom: 5.2,
center: [-119.393, 36.883],
style: 'mapbox://styles/mapbox/streets-v8'
})

map.on('load', function () {
map.addSource('counties', {
type: 'topojson',
data: 'http://devseed.com/mapbox-gl-topojson/ca.json',
workerOptions: {
layer: 'counties'
}
})

map.addLayer({
'id': 'county-boundaries',
'type': 'line',
'source': 'counties',
'paint': {
'line-color': '#EC8D8D',
'line-width': {
'base': 1.5,
'stops': [
[
5,
0.75
],
[
18,
32
]
]
}
}
}, 'country-label-lg')
})
})
</script>

</body>
</html>
2 changes: 2 additions & 0 deletions js/mapbox-gl.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ mapboxgl.Marker = require('./ui/marker');

mapboxgl.Style = require('./style/style');

mapboxgl.addSourceType = require('./source/source').addType;

mapboxgl.LngLat = require('./geo/lng_lat');
mapboxgl.LngLatBounds = require('./geo/lng_lat_bounds');
mapboxgl.Point = require('point-geometry');
Expand Down

0 comments on commit f2a3c9d

Please sign in to comment.