قالب:Location map/modulo math details

هذه هي النسخة الحالية من هذه الصفحة، وقام بتعديلها عبود السكاف (نقاش | مساهمات) في 17:58، 29 يونيو 2023 (بوت: إصلاح أخطاء فحص أرابيكا من 1 إلى 104). العنوان الحالي (URL) هو وصلة دائمة لهذه النسخة.

(فرق) → نسخة أقدم | نسخة حالية (فرق) | نسخة أحدث ← (فرق)

For a map using an إسقاط متساوي المستطيلات which does not cross +/-180 longitude, or +/-90 latitude, the following expressions can be used:

x = 100*(long - left)/(right - left)
y = 100*(lat - top)/(bottom - top)

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.

Things are a bit more complicated when the map crosses +/-180 longitude, and some sort of "modulo 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:

location lat long (x,y) test (x,y) exact
top/left 0 0 (0,0)
top/right 0 100 (100,0)
bottom/left 100 0 (0,100)
bottom/right 100 100 (100,100)
center 50 50 (50,50)