Skip to content

Commit

Permalink
Toward OpenHistoricalMap/issues#814 by adding more example queries fr…
Browse files Browse the repository at this point in the history
…om the wiki.
  • Loading branch information
erictheise committed Jun 11, 2024
1 parent b4bc561 commit 1d9f0ee
Showing 1 changed file with 55 additions and 9 deletions.
64 changes: 55 additions & 9 deletions js/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,55 @@ out;`
);
out geom;`
},
"MapCSS styling": {
overpass:
"/*\nThis example shows how the data can be styled.\nHere, some common amenities are displayed in \ndifferent colors.\n\nRead more: http://wiki.openstreetmap.org/wiki/Overpass_turbo/MapCSS\n*/\n[out:json];\n\n(\n node[amenity]({{bbox}});\n way[amenity]({{bbox}});\n relation[amenity]({{bbox}});\n);\nout body;\n>;\nout skel qt;\n\n{{style: /* this is the MapCSS stylesheet */\nnode, area\n{ color:gray; fill-color:gray; }\n\nnode[amenity=drinking_water],\nnode[amenity=fountain]\n{ color:blue; fill-color:blue; }\n\nnode[amenity=place_of_worship],\narea[amenity=place_of_worship]\n{ color:grey; fill-color:grey; }\n\nnode[amenity=~/(restaurant|hotel|cafe)/],\narea[amenity=~/(restaurant|hotel|cafe)/]\n{ color:red; fill-color:red; }\n\nnode[amenity=parking],\narea[amenity=parking]\n{ color:yellow; fill-color:yellow; }\n\nnode[amenity=bench]\n{ color:brown; fill-color:brown; }\n\nnode[amenity=~/(kindergarten|school|university)/],\narea[amenity=~/(kindergarten|school|university)/]\n{ color:green; fill-color:green; }\n}}"
"Chronology relations": {
overpass: `
/*
* type=chronology relations can be tricky to
* deal with, especially if they don't
* explicitly contain any geometry-related
* primitives, such as when they are relations
* that only have other relations as members.
* If you want to edit the data this search
* returns in JOSM, you cannot miss the meta
* reference, as the objects will have osmids,
* but no version information, which will
* block editing.
*
* This query will generate 2 warning messages
* in Overpass Turbo: the first is about a
* large dataset (select "Continue Anyway"),
* and the the second is about "Incomplete
* data." This second warning is about the
* fact that some (all, in this case) of the
* results have no supporting geometries. This
* is fine. Select "Show Data" and then click
* on the "Data" button in the upper right
* corner of the web page UI.
*/
[out:xml];
/*
* Get chronology relations with other
* appropriate criteria.
*/
relation["type"="chronology"]["source:name"="Newberry Library Atlas of Historical County Boundaries"];
/*
* Recurse down and get the members
* of each chronology.
*/
(._;>;);
/*
* Output the osm object metadata - e.g.,
* non-tag metadata - from the query, even
* if no geometry is included.
*/
out meta;`
}
};
const examples_initial_example = "Theatres in 1975";
Expand Down Expand Up @@ -364,10 +410,10 @@ settings.define_upgrade_callback(27, (s) => {
s.saves["Total railway distance in 1975"] = s.saves["List Areas"];
delete s.saves["List Areas"];
}
// add mapcss example
s.saves["MapCSS styling"] = {
// add Chronology relations example
s.saves["Chronology relations"] = {
type: "example",
overpass: examples["MapCSS styling"]
overpass: examples["Chronology relations"]
};
s.save();
});
Expand Down Expand Up @@ -454,7 +500,7 @@ settings.define_upgrade_callback(31, (s) => {
case "Mountains in Area":
case "Changes on this day in history":
case "Where am I?":
case "MapCSS styling":
case "Chronology relations":
save.overpass = examples[name].overpass;
break;
default:
Expand All @@ -467,8 +513,8 @@ settings.define_upgrade_callback(31, (s) => {

settings.define_upgrade_callback(32, (s) => {
// fix typo in query definition
s.saves["MapCSS styling"].overpass = s.saves[
"MapCSS styling"
s.saves["Chronology relations"].overpass = s.saves[
"Chronology relations"
].overpass.replace("<;", ">;");
s.save();
});
Expand Down

0 comments on commit 1d9f0ee

Please sign in to comment.