Commons:Geocoding/Panorama

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

This project connects two projects. It takes information about the positions of POIs (point of interests) from Wikipedia and shows them on Commons panorama images. So it connects Wikipedia:WikiProject Geographical coordinates and Commons:Geocoding.

For an example, see this example-image. Images with this feature are shown on Category:Media_with_locations/Panorama; their description pages have a box named "Panorama-overlay" with a link you can follow.

How it works[edit]

We save the parameters on Commons in Template:Location-Panorama, so everybody can participate in this project. With these parameters we start a script that uses the camera position, the angles between the left and right image borders and the North Pole, and the image width to calculate the positions of the objects in the image. But this script can also be used to change the language and help generate new templates for Commons, see below.

Brief syntax description for Template:Location-Panorama[edit]

Sketch of parameters
Syntax
  • lon: longitude (decimal) camera location
  • lat: latitude (decimal) camera location
  • left: angle between direction of the North Pole and the left border of the image, measured clockwise (in degrees)
  • right: left angle plus horizontal field of view (in degrees), the value may be bigger than 360°.
  • rang: range / dimension of the area with objects (in square kilometers)
  • image: image name on Commons
  • la: preferred language
  • pix: shown image width (in pixels)
  • limit: maximum number of objects in the square (not all must be in the image)
  • thumb: (yes or no) indicates whether the image resizing function of Commons is used
  • height1: distance from the top of the screen to the uppermost objects (in pixels)
  • height2: distance from the uppermost/farthest objects to the lowermost/nearest objects (in pixels)
  • exp: (explanation coming soon)
  • alt: this is the camera height above ground (in meters). If this value is given, the script uses arctan(distance/height) to calculate the position of a label. If this value is not given then the vertical label position is linear or calculated using exp.
  • maxheight: cuts labels at but tom (?) edge (in pixels)
Example
{{Location-Panorama
|lon=-73.985833
|lat=40.747778
|left=0
|right=79
|rang=30
|image=Assemblage.jpg
|la=en
|pix=3000
|limit=200
|thumb=yes
|height1=50
|height2=300
}}

Template usage[edit]

  • The template seems only useful if more than 5 Wikipedia articles are visible in the image.
  • You need to know the exact camera location. Sometimes you can use things in the foreground to get this position. Applications like Google Maps can also help you.
  • For beginners it is best to start from an image where the script is already working. Then edit the URL, change the image name and the lat/lon parameters.
  • The image width parameter pix should take a value so that the image height fills a normal screen (900px). But this value also depends on the image quality and object density. Don't play too much with this parameter, because for each value a new thumbnail has to be generated.
  • Determination of the left and right angles might seem difficult, but it's very easy. Start the script without the left and right parameters in the URL, then you get a form where you can select an object for the left calibration point. Then click into the image below to tell the script where the object is. Then do the same for the right calibration point. You're done. The script is now calculating the angles for the left and the right image borders. Both objects should be close to the borders and clearly visible. You should check which point of the object is actually geocoded in Wikipedia—for example, for a church it might not always be the steeple—by clicking on the geocoded point. Of course, you can also do it manually.
  • For the alt parameter, you need to estimate the altitude of the camera above ground. It works well only if you have a high building or mountain in a nearly flat area.
  • Play a little bit with different height1, height2, limit and range values. The Labels can also be a little bit higher than the object.
  • Below the image you can find the filled-out {{Location dec}} and {{Location-Panorama}} templates which you can copy onto the Commons image description page if you are satisfied with the result.
Compass Card.png

The script[edit]

Source code[edit]

The source code is here.

Hints for image viewing[edit]

  • If you move the mouse over a label, it shifts to the foreground. This can be useful if the label is hidden by another label.
  • If an interesting image part is hidden by labels and you want to see this area then use the browser function to make the font size very small.

Data[edit]

Location data is coming from Wikipedia-World.

Participants[edit]