← ver edição anterior | Revisão das 19h38min de 11 de janeiro de 2022 | ||
Linha 9: | Linha 9: | ||
local defaultLang = mw.language.getContentLanguage().code
|
local defaultLang = mw.language.getContentLanguage().code
|
||
local defaultLink = ‘ptwiki’ — modify to your local wiki, like frwiki
|
local defaultLink = ‘ptwiki’ — modify to your local wiki, like frwiki
|
||
local size_logo =
|
local size_logo = 13
|
||
local showdebug = false
|
local showdebug = false
|
||
local ignoreCoordinate = false
|
local ignoreCoordinate = false
|
||
local linkback
|
local linkback
|
||
local showsource =
|
local showsource = false–parameter to help present sources, if they are present in Wikidata. Make sure false for frwiki as they do not want sources in that table
|
||
local with_bearing=true–parameter to help decide to calculate with bearing or with classic line direction method (false)
|
local with_bearing=true–parameter to help decide to calculate with bearing or with classic line direction method (false)
|
||
Linha 337: | Linha 337: | ||
local bearingafter
|
local bearingafter
|
||
local angle
|
local angle
|
||
if lineDetail.beforeCoordinate then
|
if lineDetail.beforeCoordinate and lineDetail.beforeCoordinate.latitude then
|
||
|
|||
bearingbefore=bearing ( mainCoordinate.latitude, mainCoordinate.longitude, lineDetail.beforeCoordinate.latitude, lineDetail.beforeCoordinate.longitude)
|
bearingbefore=bearing ( mainCoordinate.latitude, mainCoordinate.longitude, lineDetail.beforeCoordinate.latitude, lineDetail.beforeCoordinate.longitude)
|
||
end
|
end
|
||
if lineDetail.afterCoordinate then
|
if lineDetail.afterCoordinate and lineDetail.afterCoordinate.latitude then
|
||
|
|||
bearingafter=bearing ( mainCoordinate.latitude, mainCoordinate.longitude, lineDetail.afterCoordinate.latitude, lineDetail.afterCoordinate.longitude)
|
bearingafter=bearing ( mainCoordinate.latitude, mainCoordinate.longitude, lineDetail.afterCoordinate.latitude, lineDetail.afterCoordinate.longitude)
|
||
angle = 180 – math.abs(math.abs(bearingbefore – bearingafter) – 180)
|
angle = 180 – math.abs(math.abs(bearingbefore – bearingafter) – 180)
|
||
end
|
end
|
||
if bearingbefore==nil and bearingafter==nil
|
|||
⚫ | |||
then–means wikidata is not well filled, no P197 with qualifyers at all
|
|||
⚫ | |||
if bearingbefore<=205 –not too close to 180°
|
if bearingbefore<=205 –not too close to 180°
|
||
–(bearingbefore<135.0 or bearingbefore>315.0) –truely heading North for “after”
|
–(bearingbefore<135.0 or bearingbefore>315.0) –truely heading North for “after”
|
もっと詳しく