Hi Linda
If you need to split the imagery into smaller tiles, the Python Image library
can do it. The following Python script can read in PNG, JPG or TIF files with
associated world reference files and split them into 10 x 10.
Once the splitting has been done, gdaltindex can create an index Shape file
which can then be served via Mapserver.
_______________________________________
import sys, string, os
import Image
for infile in sys.argv[1:]:
try:
im = Image.open(infile)
imname, imformat = string.split(str(infile),".")
imwidth, imheight = im.size
#print str(imwidth), str(imheight)
# read in world file
if (imformat == "jpg"):
worldf = open(imname+".jgw","r")
elif (imformat == "png"):
worldf = open(imname+".pgw","r")
elif (imformat == "tif"):
worldf = open(imname+".tfw","r")
dmpout = open("temp.dmp","a")
pixelsize1 = float(worldf.readline())
rot1 = worldf.readline()
rot2 = worldf.readline()
pixelsize2 = worldf.readline()
xulc = float(worldf.readline())
yulc = float(worldf.readline())
worldf.close()
leftbnd = xulc - (0.5 * pixelsize1)
upperbnd = yulc + (0.5 * pixelsize1)
rightbnd = leftbnd + (imwidth * pixelsize1)
bottombnd = upperbnd - (imheight * pixelsize1)
dmp = infile + ", " + str(leftbnd) + ", " + str(bottombnd) + ", " +
str(rightbnd) + ", " + str(upperbnd) + "\n"
dmpout.writelines(dmp)
dmpout.close()
if ((imwidth % 10) != 0) or ((imheight % 10) != 0):
#print str(infile) + " is not neatly divisible by 10"
imwidth = int((round(imwidth / 10)) * 10)
imheight = int((round(imheight / 10)) * 10)
im = im.resize((imwidth,imheight),Image.BICUBIC)
im.save(infile)
imtilex = imwidth / 10
imtiley = imheight / 10
yi = 0
upper = 0
while yi < 10:
xi = 0
left = 0
while xi < 10:
bottom = upper + imtiley
right = left + imtilex
box = (left, upper, right, bottom)
imsub = im.crop(box)
# print left, upper, right, bottom
subname = imname+".0"+str(xi)+"0"+str(yi)+"." + imformat
imsub.save(subname)
#print subname
xi = xi + 1
left = right
upper = bottom
yi = yi + 1
except IOError:
pass
_____________________________________________
Cheers,
Robert Sanson
Robert Sanson, BVSc, MACVSc, PhD
Geospatial Services
AsureQuality Limited
PO Box 585, Palmerston North
NEW ZEALAND
Phone: +64 6 351-7990
Fax: +64 6 351-7919
Mobile: 021 448-472
E-mail: [EMAIL PROTECTED]
>>> "Linda Rawson" <[EMAIL PROTECTED]> 22/07/2008 8:29 a.m. >>>
This is really off topic but I need some help. We have a mapping provider that
can give us georeferenced images that would in turn need to be split up into
tiles and put on a WMS service. How does a complete novice go about this?
What should I tell them to give us the images in? Should they be in geo-tiff
format? Is there some kind of image splitter that takes the big image and
splits it into tiles?
--
Linda Rawson
Click here ( https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg== ) to
report this email as spam.
------------------------------------------------------------------
The contents of this email are confidential to AsureQuality. If you have
received this communication in error please notify the sender immediately and
delete the message and any attachments. The opinions expressed in this email
are not necessarily those of AsureQuality. This message has been scanned for
known viruses before delivery. AsureQuality supports the Unsolicited Electronic
Messages Act 2007. If you do not wish to receive similar communications in
future, please notify the sender of this message.
------------------------------------------------------------------
This message has been scanned for malware by SurfControl plc.
www.surfcontrol.com
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users