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

Add amenity=internet_cafe icon #3451

Closed
kocio-pl opened this issue Oct 16, 2018 · 25 comments · Fixed by #3463
Closed

Add amenity=internet_cafe icon #3451

kocio-pl opened this issue Oct 16, 2018 · 25 comments · Fixed by #3463

Comments

@kocio-pl
Copy link
Collaborator

Since this is quite popular amenity (it has 5090 uses now), which is not "cafe" (there is special key for real cafe and other objects, for which it's not a primary property - internet_access), I would add the icon like brown @symbol, which is typical Internet-related sign.

https://wiki.openstreetmap.org/wiki/Tag:amenity%3Dinternet_cafe

taghistory 64

@kocio-pl kocio-pl added this to the New features milestone Oct 16, 2018
@jeisenbe
Copy link
Collaborator

I've just got kosmtik running, so I could do some testing renderings now!

I'm looking for a good SVG image file for the @ symbol, but the ones I've found are not sized the same as our 14 pixel SVGs. Is there a good application I can use for resizing and editing SVGs?

@kocio-pl
Copy link
Collaborator Author

Great! I was about to ask you how is it going. 😄

I, and probably many other people, do SVG editing using multi platform application Inkscape (distributed under open source license).

@jeisenbe
Copy link
Collaborator

I haven't been able to find a download an Inkscape package for MacOSX 10.13.16 (High Sierra). It looks like there is a "Homebrew" option but I'm not sure about trying that yet.

@Tomasz-W, could you make an @ "at" symbol icon for this issue?

(I'm also having trouble finding internet cafes! I thought there were 4 in the Azores, but they are located at the same place as several amenity=bank, so didn't render. I'm trying Lebanon now. Is there a good tool for downloading just a small area of a city, rather than a whole country?)

@kocio-pl
Copy link
Collaborator Author

Isn't this package proper for you?

https://inkscape.org/release/0.92.2/mac-os-x/

Finding and exporting small area is rather easy:

  1. Go to https://taginfo.openstreetmap.org/tags/amenity=internet_cafe
  2. Click Overpass turbo
  3. Set the area you want to try
  4. Click "Run/Execute" (or whatever English version might be...) - if there are no objects just check another area
  5. Click on the object you want to render
  6. When seeing data on the standard OSM.org page click Export on top and then click Export button (or "Overpass API" link if there are any problems)

This will let you download map.osm file which you can import the same as PBF files.

I also try to zoom in/out an object on the map, so the proper zoom+position appears in the URL. Then I copy it from URL (something like 18/52.25436/21.03768) and paste it in the Kosmtik URL (like http://127.0.0.1:6789/openstreetmap-carto/#18/52.25436/21.03768), so I don't loose the time to find it and render a lot of tiles along the way.

Did it help you?

@jeisenbe
Copy link
Collaborator

jeisenbe commented Oct 18, 2018 via email

@polarbearing
Copy link
Contributor

inkscape is on macports as well:

# port search inkscape
inkscape @0.92.3 (graphics, gnome)
    This is the current stable release version of Inkscape.
inkscape-app @0.92_1 (aqua, graphics)
    Inkscape.app application bundle

@Adamant36
Copy link
Contributor

@jeisenbe, why not just go to Geofabrics website and download a .pbf file? A lot of them are really small and its alot easier then trying to convert something into one. Then you just put in the osm directory, rename it data.osm.pbf, and do the docker up import thing.

@jeisenbe
Copy link
Collaborator

jeisenbe commented Oct 18, 2018 via email

@Adamant36
Copy link
Contributor

Thats good. Did you try OverPass Turbo? It should tell you where they are.

@Tomasz-W
Copy link

@jeisenbe Here you go: https://gist.github.com/Tomasz-W/1acbd56a526463b3d38fcc82c8028551. Good luck with test renderings and (I believe) PR :)

@Adamant36
Copy link
Contributor

@Tomasz-W, you should try coding sometime. It can be kind of fun ;)

@jeisenbe
Copy link
Collaborator

jeisenbe commented Oct 18, 2018 via email

@Tomasz-W
Copy link

@jeisenbe For more technical help ask @kocio-pl or @Adamant36

@kocio-pl
Copy link
Collaborator Author

@jeisenbe From what you've described, you probably just added a styling code into amenity-points.mss file (just remember to add both icon styling and label styling - they are in separate sections), but did not add the proper code into project.mml in few sections (called data layers), where the data is selected from the database for styling. This is a technical requirement to have sane performance with that many objects we render, reading all the data at once would kill the servers, so it creates burden for coders, but is important.

I suggest to look another similar amenity there and do it the same (4 layers if I remember correctly - line object, node object, line text and node text). This way you don't have to learn SQL. For example you might look at some earlier PR code, like #3434.

I hope this is more clear now, if you need further assistance, you're welcome to write about it.

@jeisenbe
Copy link
Collaborator

jeisenbe commented Oct 19, 2018 via email

@kocio-pl
Copy link
Collaborator Author

Sorry to hear that. In case you will be able to run it again, you might just push your code changes to your OSM Carto fork, so I can just see it.

@jeisenbe
Copy link
Collaborator

jeisenbe commented Oct 19, 2018 via email

@jeisenbe
Copy link
Collaborator

jeisenbe commented Oct 19, 2018

I tried again on a different computer, and I tried cloning my repository again and using that. The text name label is still rendering, but not the icon. Here are a couple examples from the Azores, all with the same name but different locations. I guess it is a chain of internet cafes?

  1. Espaçio TIC z18
    espaco-tic-z18

  2. Espaçio TIC z19
    espaco-tic-z19

  3. Espaçio TIC z21
    espaco-tic-z21

But if I change the icon file it works! I copied cafe.svg and renamed it internet_cafe.svg, and now I get a brown coffee cup:

  1. Espaçio TIC z18
    espaco-z18-cup

  2. Espaçio TIC z19
    espaco-z19-cup

  3. Espaçio TIC z21
    espaco-z21-cup

Can someone else try the code on my branch?

Or would @Tomasz-W be willing to make a different version of the "at" symbol icon? Maybe the problem is that it is based on a font character rather than an abstract shape?

@Adamant36
Copy link
Contributor

@jeisenbe, I can give it a try tomorrow. There might be a chance its something to do with the icon though. There's been a couple of them that didn't display correctly for whatever reason.

@jragusa
Copy link
Contributor

jragusa commented Oct 19, 2018

@jeisenbe, it's seem that your svg file is broken. Try to download it from the "Download zip" button in the link provided by @Tomasz-W

@Adamant36
Copy link
Contributor

Adamant36 commented Oct 19, 2018

@jeisenbe, you might want to move the code for the text rendering down one column to line 739. Its a more appropriate place for it. I wouldn't put an internet cafe in the same category as a courthouse or prison. Plus, then the code would only be one line, instead of two.

@Tomasz-W
Copy link

@jeisenbe I've updated (cleaned) icon file: https://gist.github.com/Tomasz-W/1acbd56a526463b3d38fcc82c8028551. Please try it now.

@jeisenbe
Copy link
Collaborator

  1. @Adamant36, thank you for the suggestion. I was having trouble understanding the current categorization. The lists of amenities in the project.mml file also appear to be almost randomly ordered.

  2. I found out how to render from .osm files. This code can be used change the expected database file when you import the database with Docker, as suggested in the Docker.md file. So now I can download .osm files from the main openstreetmap.org page, or export files from the JOSM editor; very useful!

OSM2PGSQL_DATAFILE=file_name.osm \
docker-compose up import 
  1. @Tomasz-W, thank you! Here's what it looks like now:
  1. Icon only; label is blocked by shop to the south, at z17
    internet_cafe-z17

  2. Internet Cafe icon and label, at z18
    internet_cafe-z18

  3. Second location, at z19
    internet_cafe-z19

  4. Third location, at z21
    internet_cafe-z21

Should I do a PR, or do we need more test renderings first?

@kocio-pl
Copy link
Collaborator Author

For me it's simple enough case that does not need more testing. Just make sure to show one example of node + label and second one of way + label - such two examples cover most of the problems the code of typical shop/amenity could have.

I also think that file_name.osm might be simply renamed into .pbf and it would be imported anyway, because osm2pgsql does not check if the extension matches file format. 😄

@jeisenbe
Copy link
Collaborator

I didn't find many mapped as closed ways, but here is one in an underground mall in Stuttgart, Germany:
https://www.openstreetmap.org/way/436919789

Rendering at z19:
internet-germany

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

Successfully merging a pull request may close this issue.

6 participants