<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AMapClip</id>
	<title>Module:MapClip - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AMapClip"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:MapClip&amp;action=history"/>
	<updated>2026-05-12T00:18:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:MapClip&amp;diff=143926&amp;oldid=prev</id>
		<title>imported&gt;Wnt: I don&#039;t think either of these is used!</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:MapClip&amp;diff=143926&amp;oldid=prev"/>
		<updated>2013-04-16T04:38:41Z</updated>

		<summary type="html">&lt;p&gt;I don&amp;#039;t think either of these is used!&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt; --- The purpose of this module is to clip out a segment from a set of files that makes up a map&lt;br /&gt;
 --- various annotations and scale bars should be added.&lt;br /&gt;
 --- The spritedraw function is being considered as a possible direct copy (future &amp;quot;require&amp;quot;)&lt;br /&gt;
 --- from Module:Sprite - however, both modules are too inchoate at this time to do that confidently,&lt;br /&gt;
 --- and some modification may be needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local p={}&lt;br /&gt;
&lt;br /&gt;
function processdegrees(degreestring)&lt;br /&gt;
    local neg=mw.ustring.match(degreestring,&amp;quot;^%s*%-&amp;quot;) or mw.ustring.match(degreestring,&amp;quot;S&amp;quot;) or mw.ustring.match(degreestring,&amp;quot;W&amp;quot;)&lt;br /&gt;
    if neg then neg=-1 else neg=1 end&lt;br /&gt;
    local onenumber=mw.ustring.match(degreestring,&amp;quot;^[^%d%.]*([%d%.]+)[^%d%.]*$&amp;quot;)&lt;br /&gt;
    if onenumber then&lt;br /&gt;
        return (neg*tonumber(onenumber))&lt;br /&gt;
    else local deg=mw.ustring.match(degreestring,&amp;quot;^[^%d%.]*([%d%.]+)&amp;quot;)&lt;br /&gt;
        if not(deg) then return nil end&lt;br /&gt;
        local min=mw.ustring.match(degreestring,&amp;quot;^[^%d%.]*[%d%.]+[^%d%.]*([%d%.]+)&amp;quot;)&lt;br /&gt;
        local sec=mw.ustring.match(degreestring,&amp;quot;^[^%d%.]*[%d%.]+[^%d%.]*[%d%.]+[^%d%.]*([%d%.]+)&amp;quot;)&lt;br /&gt;
        return neg*(tonumber(deg)+tonumber(min or 0)/60+tonumber(sec or 0)/3600)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
function spritedraw(left,right,top,bottom,image,imagewidth,scale,float)&lt;br /&gt;
    top=math.floor(top*scale)&lt;br /&gt;
    bottom=math.ceil(bottom*scale)&lt;br /&gt;
    left=math.floor(left*scale)&lt;br /&gt;
    right=math.ceil(right*scale)&lt;br /&gt;
    local scalestring=&amp;quot;&amp;quot;&lt;br /&gt;
    if scale~=1 then scalestring=math.floor(imagewidth*scale)..&amp;#039;px|&amp;#039; end&lt;br /&gt;
    output=&amp;#039;&amp;lt;div style=&amp;quot;position:absolute;overflow:visible;&amp;#039;..float..&amp;#039;top:&amp;#039;..(15-top)..&amp;#039;px;left:&amp;#039;..(40-left)..&amp;#039;px;clip:rect(&amp;#039;..top..&amp;#039;px,&amp;#039;..right..&amp;#039;px,&amp;#039;..bottom..&amp;#039;px,&amp;#039;..left..&amp;#039;px);&amp;quot;&amp;gt;[[File:&amp;#039;..image..&amp;#039;|&amp;#039;..scalestring..&amp;#039;]]&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
    return output&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.map(frame)&lt;br /&gt;
    --- variables &amp;quot;map&amp;quot; refer to the original image file&lt;br /&gt;
    --- variables &amp;quot;region&amp;quot; refer to the clipped area to be displayed&lt;br /&gt;
   local debuglog=&amp;quot;&amp;quot;&lt;br /&gt;
   local args=frame.args&lt;br /&gt;
   local parent=frame.getParent(frame)&lt;br /&gt;
   local pargs=parent.args&lt;br /&gt;
    --- pixel values (setting regionwidth forces scaling.&lt;br /&gt;
    --- Regionheight may not be implemented because there&amp;#039;s no way to 1-way scale I know of&lt;br /&gt;
   local mapwidthpx=args.mapwidthpx or pargs.mapwidthpx&lt;br /&gt;
   local mapheightpx=args.mapheightpx or pargs.mapheightpx&lt;br /&gt;
   local directions={&amp;#039;north&amp;#039;,&amp;#039;south&amp;#039;,&amp;#039;east&amp;#039;,&amp;#039;west&amp;#039;}&lt;br /&gt;
   local north,south,east,west=1,2,3,4&lt;br /&gt;
   local worldedge={90,-90,180,-180}&lt;br /&gt;
   local mapedgestring,mapedge,regionedgestring,regionedge={},{},{},{}&lt;br /&gt;
   for d =1,4 do&lt;br /&gt;
      mapedgestring[d]=args[&amp;#039;map&amp;#039;..directions[d]..&amp;#039;edge&amp;#039;] or args[&amp;#039;map&amp;#039;..directions[d]..&amp;#039;edge&amp;#039;] or &amp;quot;&amp;quot;&lt;br /&gt;
      mapedge[d]=processdegrees(mapedgestring[d]) or worldedge[d]&lt;br /&gt;
      regionedgestring[d]=args[&amp;#039;region&amp;#039;..directions[d]..&amp;#039;edge&amp;#039;] or args[&amp;#039;region&amp;#039;..directions[d]..&amp;#039;edge&amp;#039;] or &amp;quot;&amp;quot;&lt;br /&gt;
      regionedge[d]=processdegrees(regionedgestring[d]) or worldedge[d]&lt;br /&gt;
   end&lt;br /&gt;
   local mapwidthdeg=mapedge[east]-mapedge[west]&lt;br /&gt;
   if mapwidthdeg&amp;lt;=0 then mapwidthdeg=mapwidthdeg+360 end&lt;br /&gt;
   local regionwidthdeg=regionedge[east]-regionedge[west]&lt;br /&gt;
   if regionwidthdeg&amp;lt;=0 then regionwidthdeg=regionwidthdeg+360 end&lt;br /&gt;
   local mapfile=args.mapfile or pargs.mapfile or &amp;quot;&amp;quot;&lt;br /&gt;
   local mapfiles={}&lt;br /&gt;
   local row=0&lt;br /&gt;
   mapfile=mapfile..&amp;quot;|&amp;quot; -- last row will be processed like the others&lt;br /&gt;
   while mw.ustring.match(mapfile,&amp;quot;|&amp;quot;) do&lt;br /&gt;
       row=row+1&lt;br /&gt;
       local rowtext=mw.ustring.match(mapfile,&amp;quot;^([^|]*)|&amp;quot;)&lt;br /&gt;
       mapfiles[row]={}&lt;br /&gt;
       prowl=mw.ustring.gmatch(rowtext,&amp;quot;%[%[([^%[%]])*%]%]&amp;quot;)&lt;br /&gt;
       repeat&lt;br /&gt;
           local f=prowl()&lt;br /&gt;
           if not f then break;end&lt;br /&gt;
           table.insert(mapfiles[row],f)&lt;br /&gt;
       until false&lt;br /&gt;
       mapfile=mw.ustring.gsub(mapfile,&amp;quot;^[^|]*|&amp;quot;,&amp;quot;&amp;quot;)&lt;br /&gt;
   end&lt;br /&gt;
   if not mapfiles[1][1] then&lt;br /&gt;
       mapedge={90,-90,180,-180} -- ad hoc calibration was done here, but turned out to be a bug!&lt;br /&gt;
       if regionwidthdeg&amp;lt;=60 then&lt;br /&gt;
           mapwidthpx=1800&lt;br /&gt;
           mapheightpx=1800&lt;br /&gt;
           mapfiles=&lt;br /&gt;
{{&amp;#039;Topographic30deg_N60W150.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60W120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60W90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60W60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60W30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60W0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60E0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60E30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60E60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60E90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60E120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N60E150.png&amp;#039;},&lt;br /&gt;
{&amp;#039;Topographic30deg_N30W150.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30W120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30W90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30W60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30W30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30W0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30E0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30E30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30E60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30E90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30E120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N30E150.png&amp;#039;},&lt;br /&gt;
{&amp;#039;Topographic30deg_N0W150.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0W120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0W90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0W60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0W30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0W0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0E0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0E30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0E60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0E90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0E120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_N0E150.png&amp;#039;},&lt;br /&gt;
{&amp;#039;Topographic30deg_S0W150.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0W120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0W90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0W60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0W30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0W0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0E0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0E30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0E60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0E90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0E120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S0E150.png&amp;#039;},&lt;br /&gt;
{&amp;#039;Topographic30deg_S30W150.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30W120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30W90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30W60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30W30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30W0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30E0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30E30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30E60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30E90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30E120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S30E150.png&amp;#039;},&lt;br /&gt;
{&amp;#039;Topographic30deg_S60W150.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60W120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60W90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60W60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60W30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60W0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60E0.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60E30.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60E60.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60E90.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60E120.png&amp;#039;,&lt;br /&gt;
&amp;#039;Topographic30deg_S60E150.png&amp;#039;}}&lt;br /&gt;
       else&lt;br /&gt;
           mapwidthpx=1991&lt;br /&gt;
           mapheightpx=1990&lt;br /&gt;
           mapfiles={{&amp;#039;WorldMap_180-0-270-90.png&amp;#039;,&amp;#039;WorldMap_270-0-360-90.png&amp;#039;,&amp;#039;WorldMap_0-0-90-90.png&amp;#039;,&amp;#039;WorldMap_90-0-180-90.png&amp;#039;},{&amp;#039;WorldMap_-180,-90,-90,0.png&amp;#039;,&amp;#039;WorldMap_-90,-90,-0,0.png&amp;#039;,&amp;#039;WorldMap_0,-90,90,0.png&amp;#039;,&amp;#039;WorldMap_-270,-90,-180,0.png&amp;#039;}}&lt;br /&gt;
       end&lt;br /&gt;
   end&lt;br /&gt;
   if not (mapwidthpx and mapheightpx) then return &amp;quot;Module:MapClip error: mapwidthpx and mapheightpx must be supplied if a map image file is specified&amp;quot; end&lt;br /&gt;
   mapwidthpx=tonumber(mapwidthpx);mapheightpx=tonumber(mapheightpx)&lt;br /&gt;
   local totalmapwidthpx=mapwidthpx*#mapfiles[1]&lt;br /&gt;
   local totalmapheightpx=mapheightpx*#mapfiles&lt;br /&gt;
   local mapheightdeg=mapedge[north]-mapedge[south]&lt;br /&gt;
   if mapheightdeg&amp;lt;=0 then return &amp;quot;[[Module:MapClip]] error: mapnorthedge is south of mapsouthedge&amp;quot; end&lt;br /&gt;
   if ((regionedge[north]-regionedge[south])&amp;lt;0) then return &amp;quot;[[Module:MapClip]] error: regionnorthedge is south of regionsouthedge&amp;quot; end&lt;br /&gt;
&lt;br /&gt;
   local widthratio=totalmapwidthpx/mapwidthdeg&lt;br /&gt;
   local heightratio=totalmapheightpx/mapheightdeg&lt;br /&gt;
   local left=(regionedge[west]-mapedge[west])*widthratio&lt;br /&gt;
   local xfile=math.floor(left/mapwidthpx)&lt;br /&gt;
   left=left-xfile*mapwidthpx&lt;br /&gt;
   local right=(regionedge[east]-mapedge[west])*widthratio-xfile*mapwidthpx&lt;br /&gt;
   local top=(mapedge[north]-regionedge[north])*heightratio&lt;br /&gt;
   local yfile=math.floor(top/mapheightpx)&lt;br /&gt;
   top=top-yfile*mapheightpx&lt;br /&gt;
   local bottom=(mapedge[north]-regionedge[south])*heightratio-yfile*mapheightpx&lt;br /&gt;
   local imagewidth=mapwidthpx&lt;br /&gt;
   local displaywidth=args.displaywidth or pargs.displaywidth or 220&lt;br /&gt;
   local float=args.float or pargs.float or nil&lt;br /&gt;
   if float then float=&amp;quot;float:&amp;quot;..float..&amp;quot;;&amp;quot; else float=&amp;quot;&amp;quot; end&lt;br /&gt;
   local nowiki=args.nowiki or pargs.nowiki&lt;br /&gt;
   local i,featurelat,featurelong,featurename,featureimage,featuresize,featuretext=0,{},{},{},{},{},{}&lt;br /&gt;
   repeat -- import all feature names, longitude, latitude&lt;br /&gt;
       i=i+1&lt;br /&gt;
       featurename[i]=args[&amp;#039;feature&amp;#039;..i] or pargs[&amp;#039;feature&amp;#039;..i]&lt;br /&gt;
       featurelat[i]=args[&amp;#039;feature&amp;#039;..i..&amp;#039;lat&amp;#039;] or pargs[&amp;#039;feature&amp;#039;..i..&amp;#039;lat&amp;#039;]&lt;br /&gt;
       featurelong[i]=args[&amp;#039;feature&amp;#039;..i..&amp;#039;long&amp;#039;] or pargs[&amp;#039;feature&amp;#039;..i..&amp;#039;long&amp;#039;]&lt;br /&gt;
       featureimage[i]=args[&amp;#039;feature&amp;#039;..i..&amp;#039;image&amp;#039;] or pargs[&amp;#039;feature&amp;#039;..i..&amp;#039;image&amp;#039;]&lt;br /&gt;
       featuresize[i]=args[&amp;#039;feature&amp;#039;..i..&amp;#039;size&amp;#039;] or pargs[&amp;#039;feature&amp;#039;..i..&amp;#039;size&amp;#039;]&lt;br /&gt;
       featuretext[i]=args[&amp;#039;feature&amp;#039;..i..&amp;#039;text&amp;#039;] or pargs[&amp;#039;feature&amp;#039;..i..&amp;#039;text&amp;#039;]&lt;br /&gt;
       if (featurelong[i]) then featurelong[i]=processdegrees(featurelong[i]) else featurelat[i]=nil end&lt;br /&gt;
       if (featurelat[i]) then featurelat[i]=processdegrees(featurelat[i]) end&lt;br /&gt;
   until (not featurelat[i])&lt;br /&gt;
   local output=&amp;quot;&amp;quot;&lt;br /&gt;
    -- first map to display&lt;br /&gt;
   local image=mapfiles[yfile+1][xfile+1] or error(&amp;quot;Module:MapClip error: &amp;quot;..tostring(yfile)..&amp;quot;:&amp;quot;..tostring(xfile)..&amp;quot; in &amp;quot;..tostring(mapfile)..&amp;quot; not found&amp;quot;)&lt;br /&gt;
   local scale=displaywidth/(right-left)&lt;br /&gt;
   output,errcode=spritedraw(left,right,top,bottom,image,imagewidth,scale,float)&lt;br /&gt;
   if right&amp;gt;mapwidthpx then&lt;br /&gt;
       local xnew=xfile+2&lt;br /&gt;
       if xnew&amp;gt;#mapfiles[1] then xnew=1 end&lt;br /&gt;
       if bottom&amp;gt;mapheightpx then&lt;br /&gt;
           local ynew=yfile+2&lt;br /&gt;
           if ynew&amp;gt;#mapfiles then ynew=1 end&lt;br /&gt;
           local image=mapfiles[ynew][xfile+1] or error(&amp;quot;Module:MapClip error: &amp;quot;..tostring(yfile)..&amp;quot;:&amp;quot;..tostring(xfile)..&amp;quot; in &amp;quot;..tostring(mapfile)..&amp;quot; not found&amp;quot;)&lt;br /&gt;
           local output2,errcode2=spritedraw(left,right,top-mapheightpx,bottom-mapheightpx,image,imagewidth,scale,float)&lt;br /&gt;
           output=output..output2;errcode=errcode or errcode2&lt;br /&gt;
           local image=mapfiles[yfile+1][xnew]&lt;br /&gt;
           local output2,errcode2=spritedraw(left-mapwidthpx,right-mapwidthpx,top,bottom,image,imagewidth,scale,float)&lt;br /&gt;
           output=output..output2;errcode=errcode or errcode2&lt;br /&gt;
           local image=mapfiles[ynew][xnew]&lt;br /&gt;
           local output2,errcode2=spritedraw(left-mapwidthpx,right-mapwidthpx,top-mapheightpx,bottom-mapheightpx,image,imagewidth,scale,float)&lt;br /&gt;
           output=output..output2;errcode=errcode or errcode2&lt;br /&gt;
       else&lt;br /&gt;
           local image=mapfiles[yfile+1][xnew]&lt;br /&gt;
           local output2,errcode2=spritedraw(left-mapwidthpx,right-mapwidthpx,top,bottom,image,imagewidth,scale,float)&lt;br /&gt;
           output=output..output2;errcode=errcode or errcode2&lt;br /&gt;
       end&lt;br /&gt;
    else if bottom&amp;gt;mapheightpx then&lt;br /&gt;
       local ynew=yfile+2&lt;br /&gt;
       if ynew&amp;gt;#mapfiles then ynew=1 end&lt;br /&gt;
       local image=mapfiles[ynew][xfile+1] or error(&amp;quot;Module:MapClip error: &amp;quot;..tostring(yfile)..&amp;quot;:&amp;quot;..tostring(xfile)..&amp;quot; in &amp;quot;..tostring(mapfile)..&amp;quot; not found&amp;quot;)&lt;br /&gt;
       local output2,errcode2=spritedraw(left,right,top-mapheightpx,bottom-mapheightpx,image,imagewidth,scale,float)&lt;br /&gt;
       output=output..output2;errcode=errcode or errcode2&lt;br /&gt;
       end&lt;br /&gt;
   end&lt;br /&gt;
   local grid=args.grid or pargs.grid&lt;br /&gt;
   if grid then -- for now only implementing an automagic grid&lt;br /&gt;
       md=regionedge[east]-regionedge[west]&lt;br /&gt;
       if md&amp;lt;0 then md=md+360 end&lt;br /&gt;
       if md&amp;lt;=30 then md=math.abs(md/2) else md=math.abs(md/3) end -- must be at least two divisions&lt;br /&gt;
       local pt=10&lt;br /&gt;
       if pt&amp;lt;=md then&lt;br /&gt;
           if (pt&amp;lt;=md/3) then pt=pt*3 end -- multiples of 30 degrees&lt;br /&gt;
           if (pt&amp;lt;=md/3) then pt=pt*3 end -- multiples of 90 degrees&lt;br /&gt;
       else while (pt&amp;gt;md) do&lt;br /&gt;
               if pt/2&amp;lt;md then pt=pt/2;break end -- first digit 5&lt;br /&gt;
               if pt/5&amp;lt;md then pt=pt/5;break end -- first digit 2&lt;br /&gt;
               pt=pt/10&lt;br /&gt;
               if pt&amp;lt;md then break end -- first digit 1&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
       local yheight=math.ceil((bottom-top)*scale)&lt;br /&gt;
       for gridline=math.ceil(regionedge[west]/pt)*pt,math.floor(regionedge[east]/pt)*pt,pt do&lt;br /&gt;
           local xpos=math.floor(((gridline-mapedge[west])*widthratio-xfile*mapwidthpx-left)*scale)&lt;br /&gt;
           output=output..&amp;#039;&amp;lt;div style=&amp;quot;position:absolute;overflow:visible;border:solid &amp;#039;..grid..&amp;#039;;border-width:0 1px 0 0;&amp;#039;..float..&amp;#039;top:15px;width:0px;height:&amp;#039;..yheight..&amp;#039;px;left:&amp;#039;..(xpos+40)..&amp;#039;px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style=&amp;quot;position:absolute;top:-2px;width:40px;font-size:75%;color:&amp;#039;..grid..&amp;#039;;text-align:right;left:&amp;#039;..(xpos+10)..&amp;#039;px;&amp;quot;&amp;gt;&amp;#039;..tostring(math.abs(gridline))..((gridline&amp;lt;0) and &amp;quot;W&amp;quot; or &amp;quot;E&amp;quot;)..&amp;#039;&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
       end&lt;br /&gt;
       for gridline=math.floor(regionedge[north]/pt)*pt,math.ceil(regionedge[south]/pt)*pt,-1*pt do&lt;br /&gt;
           local ypos=math.floor(((regionedge[north]-gridline)*heightratio)*scale)&lt;br /&gt;
           output=output..&amp;#039;&amp;lt;div style=&amp;quot;position:absolute;overflow:visible;border:solid &amp;#039;..grid..&amp;#039;;border-width:0 0 1px 0;&amp;#039;..float..&amp;#039;top:&amp;#039;..(ypos+15)..&amp;#039;px;height:0px;width:&amp;#039;..displaywidth..&amp;#039;px;left:40px;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style=&amp;quot;position:absolute;top:&amp;#039;..(ypos+6)..&amp;#039;px;width:40px;font-size:75%;color:&amp;#039;..grid..&amp;#039;;text-align:right;left:0px;&amp;quot;&amp;gt;&amp;#039;..tostring(math.abs(gridline))..((gridline&amp;lt;0) and &amp;quot;S&amp;quot; or &amp;quot;N&amp;quot;)..&amp;#039;&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
       end&lt;br /&gt;
   end&lt;br /&gt;
   if featurelat[1] then&lt;br /&gt;
       for i=1,#featurelat do&lt;br /&gt;
           if featuretext[i] then&lt;br /&gt;
               output=output..&amp;#039;&amp;lt;div style=&amp;quot;position:absolute;overflow:visible;top:&amp;#039;..math.floor(((regionedge[north]-featurelat[i])*heightratio)*scale+3)..&amp;#039;px;left:&amp;#039;..math.floor(((featurelong[i]-mapedge[west])*widthratio-xfile*mapwidthpx-left)*scale+33)..&amp;#039;px;&amp;quot;&amp;gt;&amp;#039;..featuretext[i]..&amp;#039;&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
           else&lt;br /&gt;
               local linkstring=&amp;#039;&amp;#039;&lt;br /&gt;
               if featurename[i] then linkstring=&amp;#039;|link=&amp;#039;..featurename[i]..&amp;#039;|&amp;#039;..featurename[i] end&lt;br /&gt;
               output=output..&amp;#039;&amp;lt;div style=&amp;quot;position:absolute;overflow:visible;height:15px;width:15px;top:&amp;#039;..math.floor(((regionedge[north]-featurelat[i])*heightratio)*scale+10.5-(featuresize[i] or 15)/2)..&amp;#039;px;left:&amp;#039;..math.floor(((featurelong[i]-mapedge[west])*widthratio-xfile*mapwidthpx-left)*scale+40.5-(featuresize[i] or 15)/2)..&amp;#039;px;&amp;quot;&amp;gt;[[File:&amp;#039;..(featureimage[i] or &amp;#039;Full Star Yellow.svg&amp;#039;)..&amp;#039;|&amp;#039;..(featuresize[i] or &amp;#039;15&amp;#039;)..&amp;#039;px&amp;#039;..linkstring..&amp;#039;]]&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
           end&lt;br /&gt;
       end&lt;br /&gt;
   end&lt;br /&gt;
   output = &amp;#039;&amp;lt;div style=&amp;quot;position:relative;overflow:hidden;&amp;#039;..float..&amp;#039;width:&amp;#039;..(displaywidth+60)..&amp;#039;px;height:&amp;#039;..math.ceil((bottom-top)*scale+22)..&amp;#039;px;&amp;quot;&amp;gt;&amp;#039;..output..&amp;#039;&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
   if nowiki or errcode then return frame:preprocess(&amp;quot;&amp;lt;nowiki&amp;gt;&amp;quot;..output..debuglog..&amp;quot;&amp;lt;/nowiki&amp;gt;&amp;quot;) end&lt;br /&gt;
   return output&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Wnt</name></author>
	</entry>
</feed>