Skip to content

Commit

Permalink
Fix the test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis committed Apr 9, 2024
1 parent 700c1ae commit 41547fe
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 35 deletions.
85 changes: 85 additions & 0 deletions basemap/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<script src='https://unpkg.com/[email protected]/dist/maplibre-gl.js'></script>
<script src='https://baremaps.apache.org/assets/maplibre/maplibre-gl-inspect.js'></script>
<script src='https://baremaps.apache.org/assets/maplibre/maplibre-gl-tile-boundaries.js'></script>
<link href='https://unpkg.com/[email protected]/dist/maplibre-gl.css' rel='stylesheet' />
<link href='https://baremaps.apache.org/assets/maplibre/maplibre-gl-inspect.css' rel='stylesheet' />
<link href='https://baremaps.apache.org/assets/maplibre/maplibre-gl-tile-boundaries.css' rel='stylesheet' />
<link rel="icon" type="image/x-icon" href="https://baremaps.apache.org/assets/favicon/favicon.ico">
<style>

body {
margin: 0;
}

#map {
position: fixed;
width: 100%;
height: 100%;
}

</style>
<title>Baremaps</title>
</head>
<body>
<div id="map"></div>
<script>

// Load the right-to-left plugin if necessary.
if (maplibregl.getRTLTextPluginStatus() === 'unavailable') {
maplibregl.setRTLTextPlugin(
'https://unpkg.com/@mapbox/[email protected]/mapbox-gl-rtl-text.min.js',
null,
true
);
}

// Initialize the map
let map = new maplibregl.Map({
container: 'map',
style: '/style.json',
hash: true
});


// Add the navigation control to the map
map.addControl(new maplibregl.NavigationControl());

// Add the inspect control to the map
map.addControl(new MaplibreInspect({
showMapPopup: true,
showMapPopupOnHover: false,
showInspectMapPopupOnHover: false,
popup: new maplibregl.Popup({
closeButton: true,
closeOnClick: true,
maxWidth: 'none'
})
}));

// Add the tile boundaries control to the map
map.addControl(new MaplibreTileBoundaries({
showBoundaries: false
}));

</script>
</body>
</html>
1 change: 1 addition & 0 deletions basemap/style.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions basemap/tiles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"tilejson":"2.2.0","attribution":"© <a href=\"https://www.openstreetmap.org/\">OpenStreetMap</a>","tiles":["http://localhost:9000/tiles/{z}/{x}/{y}.mvt"],"minzoom":0,"maxzoom":14,"bounds":[6.02260949059,45.7769477403,10.4427014502,47.8308275417],"center":[6.6323,46.5197,14.0],"database":"jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps","vector_layers":[{"id":"aerialway","queries":[{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aerialway'"}]},{"id":"aeroway","queries":[{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aeroway'"}]},{"id":"amenity","queries":[{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'amenity'"}]},{"id":"attraction","queries":[{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'attraction'"}]},{"id":"barrier","queries":[{"minzoom":14,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'barrier'"}]},{"id":"boundary","queries":[{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'boundary'"}]},{"id":"building","queries":[{"minzoom":13,"maxzoom":20,"sql":"\n SELECT\n id,\n tags\n || jsonb_build_object('extrusion:base',\n CASE\n WHEN tags ? 'min_height'\n THEN convert_to_number(tags ->> 'min_height', 0)\n WHEN tags ? 'building:min_height'\n THEN convert_to_number(tags ->> 'building:min_height', 0)\n WHEN tags ? 'building:min_level'\n THEN convert_to_number(tags ->> 'building:min_level', 0) * 3\n ELSE 0\n END)\n || jsonb_build_object('extrusion:height', \n CASE\n WHEN tags ? 'height'\n THEN convert_to_number(tags ->> 'height', 6)\n WHEN tags ? 'building:height'\n THEN convert_to_number(tags ->> 'building:height', 6)\n WHEN tags ? 'building:levels'\n THEN convert_to_number(tags ->> 'building:levels', 2) * 3\n ELSE 6\n END) as tags,\n geom\n FROM osm_ways\n WHERE (tags ? 'building' OR tags ? 'building:part') AND ((NOT tags ? 'layer') OR convert_to_number(tags ->> 'layer', 0) >= 0)"},{"minzoom":13,"maxzoom":20,"sql":"\n SELECT\n id,\n tags\n || jsonb_build_object('extrusion:base',\n CASE\n WHEN tags ? 'min_height'\n THEN convert_to_number(tags ->> 'min_height', 0)\n WHEN tags ? 'building:min_height'\n THEN convert_to_number(tags ->> 'building:min_height', 0)\n WHEN tags ? 'building:min_level'\n THEN convert_to_number(tags ->> 'building:min_level', 0) * 3\n ELSE 0\n END)\n || jsonb_build_object('extrusion:height',\n CASE\n WHEN tags ? 'height'\n THEN convert_to_number(tags ->> 'height', 6)\n WHEN tags ? 'building:height'\n THEN convert_to_number(tags ->> 'building:height', 6)\n WHEN tags ? 'building:levels'\n THEN convert_to_number(tags ->> 'building:levels', 2) * 3\n ELSE 6\n END) as tags,\n geom\n FROM osm_relations\n WHERE (tags ? 'building' OR tags ? 'building:part') AND ((NOT tags ? 'layer') OR convert_to_number(tags ->> 'layer', 0) >= 0)"}]},{"id":"highway","queries":[{"minzoom":4,"maxzoom":14,"sql":"SELECT id, tags, geom FROM osm_highway_z$zoom"},{"minzoom":14,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'highway'"}]},{"id":"landuse","queries":[{"minzoom":1,"maxzoom":13,"sql":"SELECT id, tags, geom FROM osm_landuse_z$zoom WHERE tags ? 'landuse'"},{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'landuse'"},{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'landuse'"}]},{"id":"leisure","queries":[{"minzoom":1,"maxzoom":13,"sql":"SELECT id, tags, geom FROM osm_leisure_z$zoom WHERE tags ? 'leisure'"},{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'leisure'"},{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'leisure'"}]},{"id":"man_made","queries":[{"minzoom":14,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'man_made'"}]},{"id":"natural","queries":[{"minzoom":1,"maxzoom":8,"sql":"SELECT id, tags, geom FROM osm_natural_z$zoom WHERE tags ->> 'natural' IN ('wood', 'scrub', 'heath', 'grassland', 'bare_rock', 'scree', 'shingle', 'sand', 'mud', 'water', 'wetland', 'glacier', 'beach')"},{"minzoom":8,"maxzoom":13,"sql":"SELECT id, tags, geom FROM osm_natural_z$zoom WHERE tags ->> 'natural' IN ('wood', 'scrub', 'heath', 'grassland', 'bare_rock', 'scree', 'shingle', 'sand', 'mud', 'water', 'wetland', 'glacier', 'beach')"},{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'natural' AND tags ->> 'natural' NOT IN ('coastline')"},{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'natural' AND tags ->> 'natural' NOT IN ('coastline')"}]},{"id":"ocean","queries":[{"minzoom":0,"maxzoom":10,"sql":"SELECT id, tags, geom FROM osm_ocean_simplified"},{"minzoom":10,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ocean"}]},{"id":"point","queries":[{"minzoom":1,"maxzoom":2,"sql":"SELECT id, jsonb_build_object('name', tags -> 'name', 'population', tags -> 'population', 'place', tags -> 'place') as tags, geom FROM osm_point_z$zoom WHERE tags != '{}' AND (tags ->> 'place' = 'country')"},{"minzoom":2,"maxzoom":8,"sql":"SELECT id, jsonb_build_object('name', tags -> 'name', 'population', tags -> 'population', 'place', tags -> 'place', 'capital', tags -> 'capital') as tags, geom FROM osm_point_z$zoom WHERE tags != '{}'"},{"minzoom":8,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_point_z$zoom WHERE tags != '{}'"}]},{"id":"power","queries":[{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ->> 'power' IN ('cable', 'line', 'minor_line', 'plant', 'substation')"}]},{"id":"railway","queries":[{"minzoom":9,"maxzoom":13,"sql":"SELECT id, tags, geom FROM osm_railway_z$zoom"},{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'railway'"}]},{"id":"route","queries":[{"minzoom":9,"maxzoom":13,"sql":"SELECT id, tags, geom FROM osm_route_z$zoom WHERE tags ? 'route'"},{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'route'"}]},{"id":"waterway","queries":[{"minzoom":6,"maxzoom":10,"sql":"SELECT id, tags, geom FROM osm_waterway_z$zoom WHERE tags ->> 'waterway' IN ('river')"},{"minzoom":10,"maxzoom":13,"sql":"SELECT id, tags, geom FROM osm_waterway_z$zoom WHERE tags ->> 'waterway' IN ('river', 'stream')"},{"minzoom":13,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'waterway'"}]}]}
5 changes: 3 additions & 2 deletions examples/ip-to-location/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export default {"steps": [
return {
type: "DownloadUrl",
source: nic.url,
target: `downloads/${nic.filename}.gz`
target: `downloads/${nic.filename}.gz`,
replaceExisting: true
}
}),
...nics.map(nic => {
Expand All @@ -77,7 +78,7 @@ export default {"steps": [
type: "DownloadUrl",
source: "https://download.geonames.org/export/dump/allCountries.zip",
target: "downloads/geonames-allcountries.zip",
force: true
replaceExisting: true
},
{
type: "DecompressFile",
Expand Down
3 changes: 2 additions & 1 deletion examples/naturalearth/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
{
"type": "DownloadUrl",
"source": "https://naciscdn.org/naturalearth/packages/natural_earth_vector.gpkg.zip",
"target": "natural_earth_vector.gpkg.zip"
"target": "natural_earth_vector.gpkg.zip",
"replaceExisting": true
},
{
"type": "DecompressFile",
Expand Down
85 changes: 85 additions & 0 deletions examples/openstreetmap/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<script src='https://unpkg.com/[email protected]/dist/maplibre-gl.js'></script>
<script src='https://baremaps.apache.org/assets/maplibre/maplibre-gl-inspect.js'></script>
<script src='https://baremaps.apache.org/assets/maplibre/maplibre-gl-tile-boundaries.js'></script>
<link href='https://unpkg.com/[email protected]/dist/maplibre-gl.css' rel='stylesheet' />
<link href='https://baremaps.apache.org/assets/maplibre/maplibre-gl-inspect.css' rel='stylesheet' />
<link href='https://baremaps.apache.org/assets/maplibre/maplibre-gl-tile-boundaries.css' rel='stylesheet' />
<link rel="icon" type="image/x-icon" href="https://baremaps.apache.org/assets/favicon/favicon.ico">
<style>

body {
margin: 0;
}

#map {
position: fixed;
width: 100%;
height: 100%;
}

</style>
<title>Baremaps</title>
</head>
<body>
<div id="map"></div>
<script>

// Load the right-to-left plugin if necessary.
if (maplibregl.getRTLTextPluginStatus() === 'unavailable') {
maplibregl.setRTLTextPlugin(
'https://unpkg.com/@mapbox/[email protected]/mapbox-gl-rtl-text.min.js',
null,
true
);
}

// Initialize the map
let map = new maplibregl.Map({
container: 'map',
style: '/style.json',
hash: true
});


// Add the navigation control to the map
map.addControl(new maplibregl.NavigationControl());

// Add the inspect control to the map
map.addControl(new MaplibreInspect({
showMapPopup: true,
showMapPopupOnHover: false,
showInspectMapPopupOnHover: false,
popup: new maplibregl.Popup({
closeButton: true,
closeOnClick: true,
maxWidth: 'none'
})
}));

// Add the tile boundaries control to the map
map.addControl(new MaplibreTileBoundaries({
showBoundaries: false
}));

</script>
</body>
</html>
27 changes: 1 addition & 26 deletions examples/openstreetmap/style.json
Original file line number Diff line number Diff line change
@@ -1,26 +1 @@
{
"version" : 8,
"sources" : {
"baremaps" : {
"type" : "vector",
"url" : "http://localhost:9000/tiles.json"
}
},
"layers" : [ {
"id" : "building",
"type" : "fill",
"source" : "baremaps",
"source-layer" : "building",
"layout" : {
"visibility" : "visible"
},
"paint" : {
"fill-color" : "rgba(255, 0, 0, 1)"
}
} ],
"center" : [ 9.5554, 47.166 ],
"metadata" : {
"maputnik:renderer" : "mbgljs"
},
"zoom" : 14
}
{"version":8,"sources":{"baremaps":{"type":"vector","url":"http://localhost:9000/tiles.json"}},"layers":[{"id":"building","type":"fill","source":"baremaps","source-layer":"building","layout":{"visibility":"visible"},"paint":{"fill-color":"rgba(255, 0, 0, 1)"}}],"center":[9.5554,47.166],"metadata":{"maputnik:renderer":"mbgljs"},"zoom":14}
Loading

0 comments on commit 41547fe

Please sign in to comment.