Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Icons #617

Closed
StephenAtty opened this issue Dec 15, 2023 · 13 comments
Closed

Missing Icons #617

StephenAtty opened this issue Dec 15, 2023 · 13 comments

Comments

@StephenAtty
Copy link

mbtiles created by tilemaker seem to be missing a lot of the icons.

Should look like

image

but lt looks like this

image

There are no errors in the browser console log so that suggests that the data just isn't there. I'm not getting any errors when running tilemaker either.

I suspect I've just missed something somewhere.

@systemed
Copy link
Owner

systemed commented Dec 15, 2023

This is what I get when running tilemaker with the bundled demo server and version of OSM Bright:

Screenshot 2023-12-15 at 09 03 06

Just guessing, but one possible cause is that the OpenMapTiles schema, exasperatingly, has no clarity about how names are meant to be encoded (openmaptiles/openmaptiles#930). I wonder if the version of the style you're using expects names to be in a different field from the one that tilemaker's processing script is writing. You can adjust this fairly easily in the first few lines of resources/process-openmaptiles.lua.

If you want to compare what's in the tilemaker-created tiles vs your existing tiles, you could use the inspect plugin, or vt2geojson.

@StephenAtty
Copy link
Author

We're using bright. I'll see if I can get inspect plugin to work - it seems to be throwing an error at the moment.
I've tried setting the language to en rather than nil but it seems to have made no difference

@systemed
Copy link
Owner

I think the most likely change would be changing name:latin to either name or name_en. If you can point at the exact version of the OSM Bright stylesheet you're using I can take a look.

@StephenAtty
Copy link
Author

its version 8

https://maps.tty.org.uk/bright_uk-style.json

@systemed
Copy link
Owner

Ah, I think I can see. It is the stupid OpenMapTiles name issue again.

Have a look at line 3603 in the style.json. The stylesheet contains the filter

    [ "has", "name" ]

several times, i.e. "only show if the name attribute is set".

Which is fine, but it then goes on a few lines later to say

    "text-field": "{name:latin}\n{name:nonlatin}",

i.e. "render a text label using the 'name:latin' attribute". So it looks for the name attribute, but renders the name:latin attribute. Sigh.

Easiest way to fix this would be to adjust tilemaker's Lua script (resources/process-openmaptiles.lua) so after this in line 687:

obj:Attribute(preferred_language_attribute, iname)

you add

obj:Attribute("name", iname)

then regenerate. That'll make sure it's set for both name:latin (which is preferred_language_attribute from the top of the file) and name.

@StephenAtty
Copy link
Author

That's brought them back but places have different rank values.

So in my live maps

https://tiles2.tty.org.uk/index.html#16/51.906003/-2.04701

Clyde Crescent Play area has a rank of 21, in the new maps it is 25
Cheltenham Cemetery and Crem has a rank of 5, in the new maps it is 25
Bouncers Lane Cemetery has a rank of 2. It doesn't seem to be in the new maps.

Bus Stops just dont seem to be there at all

So I think this is down to the node_keys and the poiClasses and poiClassRanks

@systemed
Copy link
Owner

Yes, it isn't a like-for-like emulation of OpenMapTiles' rank values - OpenMapTiles has some fairly complex SQL operations to generate these, and they obviously aren't available to tilemaker as it isn't a SQL-based environment.

The Lua script has a GetPOIRank function which you can tweak - as you've seen this uses poiClassRanks as a lookup.

@StephenAtty
Copy link
Author

So how do I add things like bus stops. I assume I have to look at the existing map.So a bus stop is a class of "bus" and a subclass of "bus_stop"
Similarly for railway stations which seem to be class ='railway" and a subclass of "station"

@systemed
Copy link
Owner

Ah, sorry, you need to add the extra name code near L693 of the Lua as well. So it reads

if preferred_language and obj:Holds("name:"..preferred_language) then
	iname = obj:Find("name:"..preferred_language)
	obj:Attribute(preferred_language_attribute, iname)
	obj:Attribute("name", iname)                        -- <=== insert this line
	if iname~=name and default_language_attribute then
		obj:Attribute(default_language_attribute, name)
	else main_written = iname end
else
	obj:Attribute(preferred_language_attribute, name)
	obj:Attribute("name", name)                         -- <=== insert this line
end

I've highlighted the two lines to add. Just tested it and that works fine.

@StephenAtty
Copy link
Author

That looks like its fixed it.

@StephenAtty
Copy link
Author

This is back in version 3. Making the same code changes

so

if preferred_language and Holds("name:"..preferred_language) then
iname = Find("name:"..preferred_language)
Attribute(preferred_language_attribute, iname)
Attribute("name", iname)
if iname~=name and default_language_attribute then
Attribute(default_language_attribute, name)
else main_written = iname end
else
Attribute(preferred_language_attribute, name)
Attribute("name", name)
end

Has not worked.

@systemed
Copy link
Owner

Works fine for me. With the two lines added (Attribute rather than obj:Attribute), and a GB extract generated:

galibier:vt richard$ vt2geojson http://peyresourde.local:8080/14/8124/5421.pbf
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          -1.4823925495147705,
          51.87269552179052
        ]
      },
      "properties": {
        "class": "town",
        "rank": 10,
        "name": "Charlbury",
        "name:latin": "Charlbury",
        "vt_layer": "place"
      }

i.e. the "name" tag is generated correctly as well as the standard name:latin one.

@StephenAtty
Copy link
Author

It seems that my laptop has some rather aggressive caching. I had to stop my test server stack (running on the laptop), purge the cache in Firefox, restart Firefox and then restart the server stack and it found them!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants