<div dir="ltr">Very cool Alan, thank you very much for passing on your NCL script. <div><br></div><div>One thing that is unclear to me, however, is how you code the geo coordinates into the tile layer. Is this something that is just set in your web map script? In all of the tutorial examples I have seen, it just simply sets the tile layer directory, and thats it... So, I&#39;m confused in where the geo-cooridnates are communicated. </div><div><br></div><div>Thanks, </div><div><br></div><div>Micah</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 9, 2014 at 7:19 PM, Alan Brammer <span dir="ltr">&lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Heres a reply I sent to someone on a vaguely similar thread a little while back.  The number of images you plot increases quickly so above a zoom of ~ 3 or 4 it can take a long time to work through them all. There may be (probably is) a better way to do it but this worked for me. Haven&#39;t used it for a while so it may not work the same in recent versions.  Unfortunately the ncl-talk archive machine has changed all the resources so you&#39;ll need to do some find/replace to get it to work. <div><pre style="color:rgb(0,0,0)"><br>
I believe there was a KML function development somewhere in the archives of NCL talk. Not sure of the details there, but could be worth a google.

I tested the tile idea a while back though and it was reasonably successful. Though it can require a lot of images this way and can therefore take a long time to plot them all up.
Below is my test script, I put together a while back to trial this idea (using 6.1.2 at the time).  The corners are the key part and are based on coordinate info from this page, which is very helpful for understanding how map tiling works, if you choose that route.  <a href="http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/" target="_blank">http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/</a>


Good luck,
Alan.



undef(&quot;setlatlon&quot;)
procedure setlatlon(res, z,x,y)
begin
math_pi = 355/113.    ;  The Approx for pi I use. 
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">res at mpLeftCornerLonF</a>   := x / 2^z * 360.0 - 180.0
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">res at mpRightCornerLonF</a> := (x+1) /2^z * 360.0 - 180.0
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">res at mpRightCornerLatF</a>  :=  atan(sinh(math_pi * (1 - 2 * y / 2.^z))) * 180.0 / math_pi
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">res at mpLeftCornerLatF</a>    :=  atan(sinh(math_pi * (1 - 2 * (y+1) / 2.^z))) * 180.0 / math_pi
end


undef(&quot;check_dir&quot;)
procedure check_dir(name)
begin
 if(.not.isfilepresent(name))  ;; this should maybe be fileexists() now. 
        system(&quot;mkdir &quot;+name)
 end if
end



mpres = True
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpLimitMode</a>                 = &quot;Corners&quot;        ; method to zoom
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpProjection</a> = &quot;mercator&quot;
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpPerimOn</a>            = False          ; turn off map perimeter
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpOceanFillColor</a> = -1; &quot;darkslategray1&quot;
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpInlandWaterFillColor</a> = -1; &quot;deepskyblue&quot;
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at tmXTOn</a>  = False
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at tmXBOn</a> = False
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at tmYROn</a> = False
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at tmYLOn</a> = False
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at gsnMaximize</a>= True
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpGeophysicalLineThicknessF</a> = 2.
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpOutlineDrawOrder</a> = &quot;PostDraw&quot;
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpOutlineBoundarySets</a>  =&quot;National&quot;      ; Turn on country boundaries
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpFillOn</a> = False




wkst = &quot;png&quot;
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">wkst at wkWidth</a> = 268 ; 256 with 6 pixels for a border which will get cut off.
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">wkst at wkHeight</a> = 268 ;

dir  = “/plotting_directory/“

do z = 2,4   ;    Zoom level of maps.
  check_dir(dir+z)    ;  make sure there is a directory to put the image in.

  do x=0,(2^z)-1  ;
    check_dir(dir+z+&quot;/&quot;+x+&quot;/“)   ;  make sure there is a directory to put the image in.

    do y=0,(2^z)-1
     wks = gsn_open_wks(wkst, dir+z+&quot;/&quot;+x+&quot;/&quot;+y )   ;;  zoom/x/y.png  directory structure is how most tile based utilites expect them.
     setlatlon(mpres, z,x,y) ;;  Set corners of map based on zoom level, X, and Y locations.
     if(z.ge.4)
        <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">mpres at mpDataBaseVersion</a> = “MediumRes”   ;; personal preference on plotting time vs coast line representation.
     end if
     map = gsn_csm_map(wks,mpres)  ;; create map.
     system(&quot;mogrify -fuzz 2% -transparent white -shave 6x6  &quot;+dir+z+&quot;/&quot;+x+&quot;/&quot;+y+&quot;.png”)
;; Call imagemagick to make background transparent (6.2. may have made this redundant) and trim the 6pixel border that NCL loves ( may be machine dependent );
    end do   ;  y- loop

  end do  ; x-loop

end do  ; z-loop









##############################
Alan Brammer,
PhD candidate,

Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">abrammer at albany.edu</a>&lt;mailto:<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">abrammer at albany.edu</a>&gt;
##############################</pre></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Oct 9, 2014 at 5:18 PM, Micah Sklut <span dir="ltr">&lt;<a href="mailto:micahs2005@gmail.com" target="_blank">micahs2005@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi, <div><br></div><div>I was wondering if anyone has gone through the process of creating a tile image layer from your NCL maps to use in a web software application or otherwise? </div><div><br></div><div>If so, what software did you use? </div><div><br></div><div>Many of the popular mapping applications allow you to import your own tile layers, like Google Maps. I have been looking at the open source software leaflet - <a href="http://leafletjs.com" target="_blank">leafletjs.com</a>. I am just struggling to find the most appropriate way to create the tile layer from my NCL images. For my purposes it has to be a command line tool for automation. </div><div><br></div><div>As an example. Lets say I created a world wide map of precipitation. This map would be viewable on the global scale, and then navigated or zoomed into any area for greater detail.  </div><div><br></div><div>Thank you for any suggestions, <span><font color="#888888"><br clear="all"><div><br></div>-- <br>Micah Sklut<br><br>
</font></span></div></div>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Micah Sklut<br><br>
</div>