Add raster XYZ and TileJSON options #57

This commit is contained in:
Lukas Martinelli 2017-01-08 18:04:30 +01:00
parent 7b24cbf39b
commit 7c3906fa40
2 changed files with 20 additions and 6 deletions

View file

@ -130,16 +130,26 @@ class AddSource extends React.Component {
type: 'geojson',
data: source.data || 'http://localhost:3000/geojson.json'
}
case 'tilejson': return {
case 'tilejson_vector': return {
type: 'vector',
url: source.url || 'http://localhost:3000/tilejson.json'
}
case 'tilexyz': return {
case 'tilexyz_vector': return {
type: 'vector',
tiles: source.tiles || ['http://localhost:3000/{x}/{y}/{z}.pbf'],
minZoom: source.minZoom || 0,
maxZoom: source.maxZoom || 14
}
case 'tilejson_raster': return {
type: 'raster',
url: source.url || 'http://localhost:3000/tilejson.json'
}
case 'tilexyz_raster': return {
type: 'raster',
tiles: source.tiles || ['http://localhost:3000/{x}/{y}/{z}.pbf'],
minZoom: source.minZoom || 0,
maxZoom: source.maxZoom || 14
}
default: return {}
}
}
@ -162,8 +172,10 @@ class AddSource extends React.Component {
<SelectInput
options={[
['geojson', 'GeoJSON'],
['tilejson', 'Vector (TileJSON URL)'],
['tilexyz', 'Vector (XYZ URLs)'],
['tilejson_vector', 'Vector (TileJSON URL)'],
['tilexyz_vector', 'Vector (XYZ URLs)'],
['tilejson_raster', 'Raster (TileJSON URL)'],
['tilexyz_raster', 'Raster (XYZ URL)'],
]}
onChange={mode => this.setState({mode: mode, source: this.defaultSource(mode)})}
value={this.state.mode}

View file

@ -99,8 +99,10 @@ class SourceTypeEditor extends React.Component {
}
switch(this.props.mode) {
case 'geojson': return <GeoJSONSourceEditor {...commonProps} />
case 'tilejson': return <TileJSONSourceEditor {...commonProps} />
case 'tilexyz': return <TileURLSourceEditor {...commonProps} />
case 'tilejson_vector': return <TileJSONSourceEditor {...commonProps} />
case 'tilexyz_vector': return <TileURLSourceEditor {...commonProps} />
case 'tilejson_raster': return <TileJSONSourceEditor {...commonProps} />
case 'tilexyz_raster': return <TileURLSourceEditor {...commonProps} />
default: return null
}
}