Template talk:Place

From OpenStreetMap Wiki
Jump to: navigation, search

HowTo Template

Could somebody who knows write a brief howto, mainly with ref to putting a new city into the list beneath each country. I'll then try it and feedback from a newbie perspective - Jammeh 21:32, 24 May 2006

Do you want to know how to use this template, or how to create a new template? Ojw 22:02, 24 May 2006 (UTC)
There's some information at Creating city pages -- Harry Wood 23:39, 20 April 2008 (UTC)

... in {{{area}}} ...

I have added a tag at the beginning of the template to mention a name (and provide a link) to a parent area. This should provide easier (hierarchical) navigation to parent entities. The main problem is that areas were not shown anywhere before (except for making an ad-hoc category), so they might be a bit weird at times, but i guess this will be fixed in those pages shortly (adjusting area name or making redirect pages). --Stefanb 16:12, 7 June 2007 (BST)

Tried to make it smarter (See Canada, Shanklin), but http://meta.wikimedia.org/wiki/ParserFunctions aren't working for some reasons. --Stefanb 16:54, 7 June 2007 (BST)

In Germany the Federal States are used. --Lulu-Ann 14:13, 10 July 2008 (UTC)

Geo microformat

I have just added the Geo microformat to the output of this, (and "browse link") template. The class names geo, latitude and longitude are required for this. Hope that's OK. Do any other templates need it? See also Geo on Wikipedia and the Wikipedia microformats project Pigsonthewing 10:33, 6 April 2007 (BST)

And now an hCard microformat (class="vcard" & class="fn org"), too. Pigsonthewing 21:28, 9 August 2007 (BST)

Replace image by a slippy map ?

It is possible to insert a slippy map into a wiki page.


Then we could keep the image only on the right pane and the slippy map in the core of the page.

--Pieren 14:07, 13 June 2008 (UTC)

I'll really appreciate the use of the slippymap plugin instead of the big map image. I still like the small map in the box -- for such small images a optimized rendering is better than a slippymap. --Andy 00:26, 20 July 2008 (UTC)
Good idea, though I will have to remove lots of manually added slippy maps then ;-) Lulu-Ann 14:23, 26 July 2008
I like the idea. This would enable me to put a different image in the information box on the right-hand side. Xoff 12:04, 1 May 2009 (UTC)

So currently the template uses the same image (but different sizes) for both an image in the infobox and on the page and it seems a consensus that we'de like a slippy map in the main page, and a different small static image/map in the info box; BUT we don't want to break the current manual implementations of slippy maps. I'll have a go. Martin Renvoize 13:06, 31 December 2009 (UTC)

OK, created the code and it's fairly clean and working. Would require user to explicitly invoke it using |map=yes parameter (any value with |map=) will also work). Customisable using |width=, |height=, |layer= and |zoom=.

Implementation Simply replaced;

{{ #if: {{{image|}}} |
==Map of {{{name}}} from OpenStreetMap==
[[{{{image}}}|400px|Free map of {{{name}}}]]

<span style="font-size:0.8em;">OpenStreetMap images (and underlying map data) are freely available under the [[OpenStreetMap License]]</span>
<br clear=all> |


{{ #if: {{{map|}}} |
{{{!}}align=center style="background-color:transparent;"
{{!}}align="center" {{!}} {{#tag:slippymap||lat={{{lat}}}|lon={{{long}}}|z={{{zoom|12}}}|w={{{width|400}}}|h={{{height|400}}}|layer={{{layer|mapnik}}}}}
{{!}}align="center" {{!}} <span style="font-size:0.8em;">OpenStreetMap images (and underlying map data) are freely available under the [[OpenStreetMap License]]</span><br>
{{!}}} <br clear=all> |

This category contains all pages using this template AND the image parameter. Some may be partially broken. I'm slowly going through them, checking a slippymap doesn't already exist, and adding map=yes as necessary. You could help too.

Martin Renvoize 13:40, 31 December 2009 (UTC)

t@h mapof service

I have removed the MapOf service. The t@h server has issues with this script at the moment.


* Wallpaper image:  [http://tah.openstreetmap.org/MapOf/?lat={{{lat}}}&long={{{long}}}&z={{{zoom}}}&w=1280&h=1024&format=jpeg jpeg], [http://tah.openstreetmap.org/MapOf/?lat={{{lat}}}&long={{{long}}}&z={{{zoom}}}&w=1280&h=1024&format=png png]

User:Firefishy - 10:13, 28 July 2008

It would be possible to replace this with a call to http://dev.openstreetmap.org/~ojw/GetMap/ -- User:Ojw 15:19, 25 May 2009

#ifexist does not seem to work here

I just had a look at wanted categories, saw the most wanted Musterstadt category and came to this template... Since there are two categories used to connect the place (Category:area and Category:type in area) I tried to use #ifexist in the template but...

...#ifexist does not seem to work here...

#ifexist: Category:area | Category:area | Category:type in area

But #ifexist does work (see user:katpatuka/test so if someone has a clue, change then it please ;-) --katpatuka 11:18, 3 March 2009 (UTC)

Maplint-Link in template does not seem to work

Could anyone try to fix this? I did not succeed. --Dwi Secundus 17:36, 8 March 2009 (UTC)

Should be working now --MarkS 14:26, 22 May 2009 (UTC)


I have added a tag at the end of the template to automatically insert a category.. The main problem is the category is not in the plural form (city in UK not Cities...) Take a look .. --EdoM 18:40, 2 November 2006 (UTC)

I've updated the categories being added. The changes are:
  • Changing from "Town in area" to "Towns in area". This answers an issued raised above, and makes it more consistent with other categories in the wiki (and wikipedia). The change also handles "Cities in area" and "Villages in area". This was done by using the #switch parser extension
  • It will now always allocate to "towns in area" (or city/village), previously it only did this if there wasn't a category called "area". This was odd because a category "towns in area" would be expected to be a subcategory of "area" - thus as categories where added the more specific category would be removed.
--MarkS 14:03, 22 May 2009 (UTC)
Follow up. Having made this change lots of towns were added to the category "towns in area". Showing that the template version (which didn't add this specific category if area existed) was stopping lots of categories appearing even though that category was already in use for similar areas. It it also clear that "towns in area" is in common use although the template set up the "town in area" category (in fact both seem equally popular). I'll tidy some of this up. -- User:MarkS 19:35, 24 May 2009
Seems sensible, and I can see you've gone to considerable effort to move pages into the right categories. Good work Mark! -- Harry Wood 15:11, 27 May 2009 (UTC)

Users Category

The 'Users in' category just uses the place name, this could present a problem for cities with the same name like London, England, and London, Ontario, Canada --Hai-Etlik 08:51, 10 July 2009 (UTC)

If the categories 'Users in name, subarea' or 'Users in name, area' exist, they can be used, otherwise 'Users in name' is used. Question is how the (sub)area is added to the place's name---using a comma, braces around (sub)area, with or without space? --BerndR 12:22, 10 July 2009 (UTC)
Use the same spelling like the wiki page for the city, because the page template does it. --Lulu-Ann 09:46, 15 July 2009 (UTC)


I've made a number of refinements to the template:

  • I've included instructions at the top of the template page on how to use the template (these only show on the template page itself, not when it is included on another page).
  • The template itself is added to the templates category (this can group useful templates together later)
  • zoom is now optional and will default to 12 (making the template more robust if the user doesn't enter it)
  • Comments added to the template itself to help explain the code (hopefully easier for other people to change in the future)
  • wikipedia parameter added for the title of the wikipedia article. If this isn't entered then it will default to assuming the name of the place is the wikipedia article name.
  • subarea parameter. This reflects the reality that people are using either "x in UK" or "x in Berkshire", so they enter either an area of a subarea of the area. I've chosen to use subarea rather than say country to ensure compatibility with existing uses. Entering subarea will change the initial text to "name is a type in subarea, area"
  • The template will now add pages to the category xs in subarea if subarea is entered. This will ensure the page gets added to the most specific category possible.
  • The template will now add pages to the category xs in area if xs in subarea does not exist. This ensures the page is allocated to a category that is likely to exist. However, if a more specific category exists then that will be used instead to prevent pages being placed in too many categories.

Changes were made with the aim of refining the existing template rather than changing the appearance to the end user. Amendments were made to a copy of the template and tested on that copy, to prevent large numbers of updates to all the pages using this template as the changes were made bit by bit. --MarkS 07:11, 3 June 2009 (UTC)

I have used the Magic Word lc to simplify all the #switch statements on the type parameter used to give the category xs in subarea resp. xs in area. Additionally I have included the subarea parameter in the box header (name, subarea, area). --BerndR 11:23, 7 July 2009 (UTC)
I have changed the template to only display the "Nearby" parking/pubs link for places with zoom >= 12, because that link doesn't make much sense for e.g. country pages. --Lyx 11:13, 21 February 2010 (UTC)

Hide link to ÖPNV-Karte for places outside Europe

The public transport map at www.öpnvkarte.de covers only Europe at the moment. What would be the best way to hide the useless link for places on other continents? We could use the krdb parameter that I added for the keepright links, but the areas do not match exactly (krdb=EU covers a larger area).

This also affects OSM Inspector and Geograph. Can these be guessed from the latitude and longitude? Andrew 19:14, 21 February 2010 (UTC)
ÖPNV-Karte link seems to have been removed now anyway. I think OSM Inspector is (now) worldwide hey? Yes. Geograph is UK only. I think I'll just remove it. It's not very relevant even in the UK, and completely irrelevant elsewhere. -- Harry Wood (talk) 10:16, 14 May 2013 (UTC)


Is it possible to have Internationalization in a template? I want to add it in Brazilian cities that are described in Portuguese. If not, maybe we'll need to create a template in portuguese, like place-pt-br.

It wouldn't be too hard to add something that just replaced say the main text (eg. "Reading is a town in Berkshire, UK") with something in a different language. We'd probably need to pass the same parameters in as now plus something to indicate the language. We would need to pass things like "town" in using english to ensure categorisation was consistent but we could then use the #switch parser command to swap the language on display. If we created lots of different language versions that it might be hard to keep all the templates consistent and up to date if we needed to change say the URL's in the box on the right. The other potential alternative would be make this template a combination of a number of sub-templates. Then a different language version would use the same sub-templates (making URL updating easy) and just change the language on the screen. The last set of changes I made were tested using a copy of the template. If you could let us now exactly which wording you would want different on the Portuguese version (with Portuguese wording as well) then a test version could be created to see what it looks like in practice. --MarkS 20:45, 5 June 2009 (UTC)
Thanks for your response Mark. Someone At the Brazilian mailing list created a template for the Portuguese language: Template:Pt-br:Place. I think it fits our needs because we want to emphazise other aspects about a location than the common aspects used others wikiproject countries. Thanks! vgeorge 12:22, 8 June 2009 (UTC)

zoom level

The documentation says the default is 12, but when the "zoom" parameter is left blank (via "zoom = " when it is called), an error message is generated. I cannot see where in the code the default is not working. Can anyone else? When the "zoom" parameter is omitted in the calling, it seems to work as expected, but if the value for "zoom" is declared when called as a space " ", the items like {{{zoom|12}}} do not seem to be defaulting to 12. Anyone have any ideas how to make it work? Is it necessary to use an "if" construction? j-beda 16:41, 11 May 2010 (UTC)

Interesting, good luck with that one. I hadn't nticed it before you mentioned it... I see you've been giving these templates a bit of a going over, it's nice to see someone blowing away the dust on this porject again. Martin Renvoize

osmaware is 404

Hi well your osmaware links are 404 cause the project seem to be dead: http://code.google.com/p/osmlab/ --!i! 17:16, 9 August 2010 (BST)

So it is. Should we just remove them from the templates? j-beda 16:03, 18 August 2010 (BST)

OpenStreetBugs service is discontinued

OpenStreetBugs service is deprecated, template link should be removed. Plamen (talk) 10:35, 21 January 2014 (UTC)

Although you can’t report new bugs though the link any more you can still look at existing reports that haven’t yet been closed or moved to Notes. Andrew (talk) 12:55, 21 January 2014 (UTC)

Get rid of OpenStreetBrowser

Hello. Wouldn’t it be useful to delete OpenStreetBrower from this template? The data is completly outdated.

And Osmose (a french quality checking project, similar to KeepRight) could maybe be added.

Image does not Support SVG from Commons

Image does not Support SVG from Commons which is very sad. Ogmios (talk) 11:10, 28 January 2015 (UTC)

Sure it does. See Cincinnati, Ohio for example. – Minh Nguyễn (talk, contribs) 08:45, 30 January 2015 (UTC)

Add place_id option!

The Openstreetmap place_id is the free (as free perhaps the most reliable and stable place-identifier of the Intenret)! URL template: http://nominatim.openstreetmap.org/details.php?place_id={value}


-- Krauss

Most stable ? This is not proven. These are from a source which is not necesarily reliable.
I think that Wikidata id's (Qnnn) are probably more stable and at least they are wellknown, accessible, and there's no problem of licences and copyright.
May be in some countries the "place_id" is popular, but it is not much more reliable than official sources. I think they are useful only in countries where official sources for adresses are not opendata (e.g. Japan or UK), or wherre there's no official source (and multiple third party databases, more or less complete and not necessarily updated regularly).
The place_id are just internal id's in Nominatim, not meant at all to be stable. This is only a convenient working tool which reflects the current state of Nominatim and its current (évolitive) rules to match places. — Verdy_p (talk) 13:48, 17 June 2017 (UTC)
Hi Verdy p, thanks the feedback. Can you show examples where an place_id changed? As I see it is stable (!), there are only problems with "synonymous" (same place with two or more IDs), but not "ID instability". --Krauss (talk) 18:00, 17 June 2017 (UTC)
place_id is a Nominatim internal (!) identifier. It has absolutely no relevance outside of the Nominatim database, and it even differs across Nominatim instances. Mmd (talk) 18:18, 17 June 2017 (UTC)
Thanks for this argument. Other things to consider: OSM objects are frequenetly deleted and recreated, they are not easy to restore when they are deleted and this is detected later. In the interm, Nominatim will not be able to merge the new OSM objects with the former deleted OSM objects. The Nominatiml algorithms are trying to group items using rules that may not match due to tagging differences, or quirks in the geometry. OSM does not preserve the history (unlike Wikidata which keeps historic items and is much more easily restored when items are deleted).
Basically a Nominatim instance may return its internal place_id only to create navigatable links for details about its internal objects, with URLs pointing to the same internal instance (these IDs then allow decluttering the results without having to show all details at once; you can point and click to get more details). And they are used as a diagnostic tool.
In summary, Wikidata ids (Qnnn) are much more stable (and since the begining it has alsways a design goal to have it stable). — Verdy_p (talk) 18:25, 17 June 2017 (UTC)
Thanks Verdy_p and Mmd. Well... Sorry to say "free and most reliable" (I edited phrase adding parentheses), I am convinced, and now I realize that there are no free (open source and open data) alternative to google.com/place-id...
Thanks Verdy_p, to point Wikidata as good alternative (!), lets change this suggestion, see below. --Krauss (talk) 08:47, 19 June 2017 (UTC)

Use wikidata (id) !

As discussion demonstrated, the most stable ID is the Wikidata-ID... So, the suggestion is to add in the box a wikidata_id parameter to be showed as Wikidata link and perhaps a link to the associated relation (ex. for Brazil = BR wikidata_id=Q155 and its map).

PS: for robot automation, we can use en.wikipedia parameter to translate into wikidata, as english is the most stable and there are an API... For far future, all language-links can be generated by robot via Wikidata-ID, also by API.

Wikidata has already its key used everywhere in OSM, see wikidata=Q155 for Brazil ! So I suggest you want the same filter type in Nominatim. Template:Place also has support for a wikidata parameter matching what we already have in OSM tags. Note that Wikidata values in OSM are already indexed and displayed by Nominatim in its results. What you want is to be able to search with it, but this is not the template that will do that directly. Instead we can already use Overpass API and there are already templates for linking to Overpass queries with results rendered on a map with Overpass Turbo. — Verdy_p (talk) 13:38, 19 June 2017 (UTC)
Note: I just added the |wikidata=Qnnn parameter to {{Place|lat = ... |long = ... |wikidata = Qnnn }}. — Verdy_p (talk) 14:23, 19 June 2017 (UTC)

Slippy map attribution too high up

I noticed a minor thing: The OpenLayers slippy map's OSM attribution floats up quite high in the map, caused by this CSS here in style.css:

.olControlAttribution { bottom: 4.5em; }
It should probably be
bottom: 0px;
or something along those lines. Can someone take a quick look at this? --Chrki (talk) 20:12, 25 July 2017 (UTC)
There are many more critical bugs in the slippymap (as implemented on this wiki, notably its lack of isolation causing pages that need to display multiple maps to be very badly positioned on the page, because of the total absence of a root object to manage properties and unneeded abuse of "global" variable, scoped only to the current window instead of the component itself in the window).
Other quirks are the incorrect presence of HTML paragraphs in the middle of the component, causing additional unpredicatable vertical margins: the 4.5em bottom margin is here because of these unwanted paragraphs, which assume a specific MediaWiki presentation and does not work with all skins, not even the standard ones: the actual positionining of tiles within is completely incorrectly computed.
This MediaWiki extension, specific to this wiki (not used anywhere else, and even removed from the Mediawiki extension support as it just shows bad practices), is notoriously unmaintained since long (another reason why it was removed and left there in its initial alpha stage). It should be rewritten, cleaned up, and replaced also on this wiki. Wikimedia has developed much better extensions to render maps on wiki pages without all these quirks, either in a embedded frame or in a popup panel, which is also dockable and also supports better accessbility and better support for mobiles. — Verdy_p (talk) 20:34, 25 July 2017 (UTC)