Hi Oliver,
We have done this for CLIK (http://clik.apcc21.net). Unfortunately
because we moved our office, the systems are not fully up to dig
up the code and pass it to you. I will do this in a day or two.
Meanwhile some comments...
- we produced our map in a mercator projection with no borders, maybe
we used res_at_mpPerimOn = False to prevent the white borders
- controlling size - possible with convert utility (imageMagick)
here is an old version of the code. It is in Ruby, but convert is called
as a system command...
- sizes should be specified in pixels (for computer displays)
- the code cuts image file into 256x256 pixel tiles to fit on top of
Google Map tiles
I hope to get back with correct details by tommorow...
saji
--- require 'pathname' require 'fileutils' def tile_cutter(zoom,zoom_org,padX,padY,file,ntiles) zoomDiff=zoom-zoom_org power=2**zoomDiff dim=`identify #{file}` dim= dim.match(/[0-9]*x[0-9]*/).to_s.split("x") padX=padX*power padY=padY*power width=dim[0].to_f tileWidth=width / 256 + 1 height=dim[1].to_f tileHeight=height / 256 + 1 extraWidth=tileWidth*256 - width extraHeight=tileHeight*256 - height infil=Pathname.new(file) outdir=infil.dirname.to_s var=infil.basename.to_s.split(".")[0] FileUtils.mkpath("#{outdir}/#{var}/tiles") temp=file.sub(var,var+"_til") #.sub("eps","png") `convert #{file} -bordercolor none -border #{padX}x#{padY} -crop #{width}x#{height}+0+0 +repage -bordercolor none -border #{extraWidth}x#{extraHeight} -crop +#{extraWidth}+#{extraHeight} +repage #{temp}` # pad image to tile size tempPrefix=file.sub(".png","")+"til" `convert #{temp} -crop 256x256 +repage png32:#{tempPrefix}` i=0 0.upto(ntiles) do |y| 0.upto(ntiles) do |x| print "#{x} : #{y} \n" #`feh #{tempPrefix}-#{i}` `mv #{tempPrefix}-#{i} #{outdir}/#{var}/tiles/tile_#{zoom}_#{x}_#{y}.png` i+=1 end end end zoom = 0 ntiles = Math.sqrt(4**(zoom)) xdim=256*ntiles ydim=xdim infile="../prec.eps" outfile="prec#{zoom}.png" p "Num tiles #{ntiles}" p "dimensions of image = #{xdim}" p " Convert the image from eps to png" `convert -trim -density 300 -geometry #{xdim}X#{ydim} #{infile} #{outfile}` tile_cutter(zoom,zoom,0,0,outfile,ntiles) * Oliver.Fuhrer_at_meteoswiss.ch <Oliver.Fuhrer_at_meteoswiss.ch> [2009-03-25 18:49:33 +0100]: > Hi all, > > I would like to produce an EPS file of defined size of a contour plot > with absolutely no information (!) except the filled contours. I've been > trying to play around with options (tiMainOn=False, tmYROn=False, > tmBorderThicknessF=0.0, cnGridBoundPerimOn=False, etc...) but did not > really manage. First of all the EPS always contained a white border (see > attached image), second I don't know how to exactly control the size > (for example in inch) of the resulting plot. The goal would be to create > a simple raster image by conversion that could easily be geo-referenced > and used in other software. > > Has anyone already done something like this? > > Thanks, > Oli > > > ________________________________________ > > Oliver Fuhrer > Numerical Models > > Federal Departement of Home Affairs FDHA > Federal Office of Meteorology and Climatology MeteoSwiss > > Kraehbuehlstrasse 58, P.O. Box 514, CH-8044 Zurich, Switzerland > > Tel. +41 44 256 93 59 > Fax +41 44 256 92 78 > oliver.fuhrer_at_meteoswiss.ch > www.meteoswiss.ch - First-hand information > > _______________________________________________ > ncl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/ncl-talk -- Saji N. Hameed APEC Climate Center +82 51 668 7470 National Pension Corporation Busan Building 12F Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 saji_at_apcc21.net KOREA _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Thu Mar 26 2009 - 03:04:56 MDT
This archive was generated by hypermail 2.2.0 : Mon Apr 06 2009 - 10:23:30 MDT