Module:Location map/data/Russia Chukotka Autonomous Okrug/doc: Difference between revisions

Content deleted Content added
created documentation with examples
 
Update
Line 17:
| file name of map image, without "Image:" or "File:"
|-
! topx
| {{{{BASEPAGENAME}}|topx}}
| an expression which evaluates as 0 along the left edge of the map, and 100 along the right edge of the map, where {{{2}}} and {{{3}}} are the degrees latitude and longitude respectively.
| latitude at top of equirectangular projection map
|-
! bottomy
| {{{{BASEPAGENAME}}|bottomy}}
| an expression which evaluates as 0 along the top edge of the map, and 100 along the bottom edge of the map, where {{{2}}} and {{{3}}} are the degrees latitude and longitude respectively.
| latitude at bottom of equirectangular projection map
|-
! left
| {{{{BASEPAGENAME}}|left}}
| longitude at left edge of equirectangular projection map
|-
! right
| {{{{BASEPAGENAME}}|right}}
| longitude at right edge of equirectangular projection map {{#ifexpr: {{{{BASEPAGENAME}}|right}} > 180 | <br/>(actually {{#expr:{{{{BASEPAGENAME}}|right}}-360}}, adjusted via ''crosses180'' parameter)}}
|-
! crosses180
| {{{{BASEPAGENAME}}|crosses180}}
| for equirectangular projection maps that cross the [[180th meridian]]
|}
{{clear}}
Line 130 ⟶ 118:
| lat = 66.15944
| long = -169.80917
}}
</pre>
{{clear}}
 
As shown above, the current implementation of [[Template:Location map]] does not properly display the marker on an ''equirectangular projection'' maps using <code>crosses180</code> when given a negative decimal longitude (western hemisphere). One workaround is to include the <code>lon_dir</code> parameter as shown below:
{{Location map | Russia Chukotka Autonomous Okrug
| width = 200 | float = right
| caption = Location of [[Uelen]] in Chukotka
| label = Uelen
| background = lightgreen
| position = left
| lat = 66.15944
| long = -169.80917
| lon_dir = W
}}
<pre>
{{Location map | Russia Chukotka Autonomous Okrug
| width = 200 | float = right
| caption = Location of [[Uelen]] in Chukotka
| label = Uelen
| background = lightgreen
| position = left
| lat = 66.15944
| long = -169.80917
| lon_dir = W
}}
</pre>
Line 217 ⟶ 180:
{{clear}}
 
== Technical details ==
As shown above, the current implementation of [[Template:Location map many]] does not properly display the marker on ''equirectangular projection'' maps using <code>crosses180</code> when given a negative decimal longitude (western hemisphere). One workaround is to include the parameter <code>lon_dir</code> (or <code>lon2_dir</code>, <code>lon3_dir</code>, etc.):
For a map using an [[equirectangular projection]] which does not cross +/-180 longitude, or +/-90 latitude, the following expressions can be used:
{{Location map many | Russia Chukotka Autonomous Okrug
 
| width = 200 | float = right
<code>x = 100*(''long'' - ''left'')/(''right'' - ''left'')</code><br />
| caption = [[Anyuysk]] and [[Uelen]] in Chukotka
<code>y = 100*(''lat'' - ''top'')/(''bottom'' - ''top'')</code>
| label = Anyuysk | label_size = 90
 
| bg = lightblue | pos = right
where ''lat'' and ''long'' are the degrees latitude and longitude respectively. Here, ''top'' and ''bottom'' are the degrees latitude of the top and bottom edges of the map, ''left'' and ''right'' are the degrees latitude of the left and right edges of the map.
| lat = 68.3
 
| long = 161.633
Things are a bit more complicated when the map crosses +/-180 longitude, and some sort of "module arithmetic" is required. Here, we add 360 if the longitude is less than 0, then use a mapping based on positive coordinates. The following table can be used to check if the expressions are working as desired:
| label2 = Uelen | label2_size = 90
{| class="wikitable"
| bg2 = lightgreen | pos2 = left
! ___location !! lat !! long !! (x,y) test !! (x,y) exact
| lat2 = 66.15944
|-
| long2 = -169.80917
| top/left || 72.767067||156.69525|| ({{#expr:{{{{BASEPAGENAME}}|x|72.767067|156.69525}}}},{{#expr:{{{{BASEPAGENAME}}|y|72.767067|156.69525}}}}) || (0,0)
| lon2_dir = W
|-
}}
| top/right || 72.767067||-168.170471|| ({{#expr:{{{{BASEPAGENAME}}|x|72.767067|-168.170471}}}},{{#expr:{{{{BASEPAGENAME}}|y|72.767067|-168.170471}}}}) || (100,0)
<pre>
|-
{{Location map many | Russia Chukotka Autonomous Okrug
| bottom/left || 61.662832||156.69525|| ({{#expr:{{{{BASEPAGENAME}}|x|61.662832|156.69525}}}},{{#expr:{{{{BASEPAGENAME}}|y|61.662832|156.69525}}}}) || (100,0)
| width = 200 | float = right
|-
| caption = [[Anyuysk]] and [[Uelen]] in Chukotka
| bottom/right || 61.662832||-168.170471|| ({{#expr:{{{{BASEPAGENAME}}|x|61.662832|-168.170471}}}},{{#expr:{{{{BASEPAGENAME}}|y|61.662832|-168.170471}}}}) || (100,100)
| label = Anyuysk | label_size = 90
|-
| bg = lightblue | pos = right
| center || 67.2149495||174.2623895|| ({{#expr:{{{{BASEPAGENAME}}|x|67.2149495|174.2623895}}}},{{#expr:{{{{BASEPAGENAME}}|y|67.2149495|174.2623895}}}}) || (50,50)
| lat = 68.3
}|}
| long = 161.633
| label2 = Uelen | label2_size = 90
| bg2 = lightgreen | pos2 = left
| lat2 = 66.15944
| long2 = -169.80917
| lon2_dir = W
}}
</pre>
{{clear}}
 
== See also ==