OpenHistoricalMap / issues

File your issues here, regardless of repo until we get all our repos squared away; we don't want to miss anything.
Creative Commons Zero v1.0 Universal
19 stars 1 forks source link

Add support for text bubbles in Overpass Turbo MapCSS #666

Open Kovoschiz opened 11 months ago

Kovoschiz commented 11 months ago

What's your idea for a cool feature that would help you use OHM better. Please provide a clear and concise description of the problem you'd like to solve & how you'd like to solve it. Or, the other way around! e.g. I'd like to have the inspector show time-related pictures of the object, so I can get a better idea of what the place was like at the time. I want to help visualize dates in the data from Overpass. I can color them, but not show the dates.

{{style:
node[start_date][end_date],way[start_date][end_date],relation[start_date][end_date]
{ color:black; fill-color:black; text:eval(tag("start_date"). "--". tag("end_date"));}
node[start_date][!end_date],way[start_date][!end_date],relation[start_date][!end_date]
{ color:green; fill-color:green; text:start_date;}
node[!start_date][end_date],way[!start_date][end_date],relation[!start_date][end_date]
{ color:red; fill-color:red; text:end_date;}
}}

The text maker parameter is ignored without errors. (expected for unsupported parameters)

Current workarounds Is there any way to meet this need using a workaround or "hack" right now? Not using Overpass Turbo for viewing. Only get the data from Overpass there.

Additional info Please add any other context, comparables, screenshots, pictures of drawings on napkins about the feature request here. https://wiki.openstreetmap.org/wiki/Overpass_turbo/MapCSS#Markers_with_Text https://wiki.openstreetmap.org/wiki/File:Overpass-turbo_MapCSS_marker_text.png The query is for data from a specific time period. MapCSS isn't able to evaluate dates anyway.

[out:json][timeout:25];
(
  nwr({{bbox}})[start_date][!end_date](if: date(t["start_date"]) < 1850);
  nwr({{bbox}})[end_date](if: date(t["end_date"]) >= 1800 && date(t["end_date"]) < 1850);
  nwr({{bbox}})[start_date][end_date](if: date(t["end_date"]) >= 1800 && date(t["start_date"]) < 1850); 
);
out geom;
{{style:
node[start_date][end_date],way[start_date][end_date],relation[start_date][end_date]
{ color:black; fill-color:black; text:eval(tag("start_date"). "--". tag("end_date"));}
node[start_date][!end_date],way[start_date][!end_date],relation[start_date][!end_date]
{ color:green; fill-color:green; text:start_date;}
node[!start_date][end_date],way[!start_date][end_date],relation[!start_date][end_date]
{ color:red; fill-color:red; text:end_date;}
}}
1ec5 commented 11 months ago

Another workaround would be to run the query in Overpass Ultra. However, that tool uses a Mapbox Style Specification style rather than MapCSS. You can use the main OHM style JSON as a starting point, adding a symbol layer with a text-field property that’s a get expression for the start_date or end_date property.

Kovoschiz commented 11 months ago

@1ec5 Am I correct that neither it nor Mapbox has support for evaluating dates? /mapbox/mapbox-gl-js#9436 /mapbox/mapbox-gl-js#6484

1ec5 commented 11 months ago

That’s correct. Only OverpassQL has built-in date parsing (for converting to a number, and only for 1000 CE to present). However, it looks like your query above wasn’t really parsing the dates, only comparing them lexicographically, which works.

Kovoschiz commented 11 months ago

I wanted to highlight incomplete date data in response to the original question. Eg for objects with end_date= but no start_date= (\~=15%), maybe end_date= 1850\~1900 likely existed in 1800\~1850, while 1900\~1950 is less likely.

1ec5 commented 10 months ago

You can compare the dates as strings using the < and > expression operators. This works for start_date and end_date but not start_date:edtf and end_date:edtf.

mmd-osm commented 10 months ago

i think there's at least a typo in your "eval" mapcss function, namely, you need to put the whole expression to be evaluated in single quotes: https://overpass-turbo.eu/s/1Fsu

Unfortunately, I have no idea why this isn't working on openhistoricalmap's overpass turbo instance. :(