 |
Author |
Topic: USGS Images in Processing (Read 852 times) |
|
rgovostes
|
USGS Images in Processing
« on: Feb 15th, 2004, 10:20pm » |
|
I started work on a USGS aerial photo browser in Processing, using Microsoft's TerraServer, from which images (topographic maps, relief maps, and aerial photos) can be retrieved using SOAP requests. Finding Java's implementation of SOAP to be confusing, I decided to write a simple frontend using PHP's familiar NuSOAP library. In Processing, a developer use a loadImage() call to fetch the image they wanted. However, I am having troubles with obtaining the images from the TerraService. As seen here, there seems to be a problem on Microsoft's end in accessing the database. I think that it is more likely that there is something faulty with how I am requesting the image. If anyone would like to contribute to development, please check out the TerraServer Web Services site and see if you can make something of it (there are examples in .NET code). If you'd like to see my PHP source, drop me a message at rgovost1 at dryden dot k12 dot ny dot us or I can be found on AIM using the screenname "rgovostes".
|
« Last Edit: Feb 16th, 2004, 6:23pm by rgovostes » |
|
|
|
|
rgovostes
|
Re: USGS Images in Processing (PHP)
« Reply #1 on: Feb 15th, 2004, 10:33pm » |
|
It looks like it may be easier to just directly use this, which explains how to access their images via a GET request. It should be noted that using SOAP allows more advanced things - for instance, getting coordinates for famous places, or plotting locations of schools. Fixing the SOAP problem would probably be beneficial. (code removed, see below) I will finish this up and post it in the Tools section. Suggestions and help are welcome.
|
« Last Edit: Feb 16th, 2004, 2:56am by rgovostes » |
|
|
|
|
rgovostes
|
Re: USGS Images in Processing
« Reply #2 on: Feb 15th, 2004, 11:57pm » |
|
Here's a better example. This one displays an aerial photograph of Mount St. Helens. Clicking it reveals the topographic map of the same area. Code:BImage[] a = new BImage[4]; BImage[] b = new BImage[4]; boolean pressed; void setup() { size(400, 400); // Load the aerial photographs a[0] = getPhoto(true, 15, 87, 799, 10); a[1] = getPhoto(true, 15, 88, 799, 10); a[2] = getPhoto(true, 15, 87, 798, 10); a[3] = getPhoto(true, 15, 88, 798, 10); // Load the topographic maps b[0] = getPhoto(false, 15, 87, 799, 10); b[1] = getPhoto(false, 15, 88, 799, 10); b[2] = getPhoto(false, 15, 87, 798, 10); b[3] = getPhoto(false, 15, 88, 798, 10); image(a[0], 0, 0); image(a[1], 200, 0); image(a[2], 0, 200); image(a[3], 200, 200); } void loop() { if (pressed == false && mousePressed == true) { image(b[0], 0, 0); image(b[1], 200, 0); image(b[2], 0, 200); image(b[3], 200, 200); pressed = true; } if (pressed == true && mousePressed == false) { image(a[0], 0, 0); image(a[1], 200, 0); image(a[2], 0, 200); image(a[3], 200, 200); pressed = false; } } BImage getPhoto(boolean aerial, int scale, int x, int y, int zone) { int nbrTheme; if (aerial == true) { nbrTheme = 1; // Aerial photograph (DOQ) } else { nbrTheme = 2; // Topographic map (DRG) } String URL; URL = "http://terraserver-usa.com/tile.ashx"; URL = URL + "?T=" + nbrTheme; URL = URL + "&S=" + scale; URL = URL + "&X=" + x; URL = URL + "&Y=" + y; URL = URL + "&Z=" + zone; return loadImage(URL); } |
| Some things I'd like to do to with this: - Package it as a library, so there are no messy functions to copy and paste - Write a function to grab an area of images at once and merge them together - Convert latitude/longitude to X, Y, and Zone It'd be neat to be able to smoothly zoom in to a specific coordinate, but I'm not sure how this would be done. If anyone wants to give it a go, please do! Hopefully you guys think this is as neat as I do, and I hope someone can create something cool with it!
|
« Last Edit: Feb 16th, 2004, 12:08am by rgovostes » |
|
|
|
|
rgovostes
|
Re: USGS Images in Processing
« Reply #3 on: Feb 16th, 2004, 6:48pm » |
|
Alright, after a bunch of work tinkering around in PHP, I figured out how to request an image via SOAP. It is probably better to use the TerraServer to request images - it's faster - but SOAP would be handy for converting from latitude/longitude to the x/y/zone coordinates, locating places, determining the number of tiles required to show an area, and so forth. Example: Topographic | Aerial Photo Valid themes are Photo, Topo, and Relief. Not all locations or scales are available in all themes. Valid scales are (per pixel): 1mm 2mm 4mm 8mm 16mm 32mm 63mm 125mm 250mm 500mm 1m 2m 4m 8m 16m 32m 64m 128m 256m 512m 1km 2km 4km 8km 16km ... I don't think that 'mm' is millimeters - the images don't zoom in that far. It might be miles, but that should be "mi".
|
« Last Edit: Feb 16th, 2004, 6:58pm by rgovostes » |
|
|
|
|
mKoser

|
Re: USGS Images in Processing
« Reply #4 on: Feb 17th, 2004, 7:12pm » |
|
nice. * DISCLAIMER * SENTIMENTAL NONSENSE * in 1994/1995 i lived in Ohio, having only been back once since then, i get a bit sentimental sometimes. i just found where i lived back then on Microsofts TerraServer, and as it turns out, the picture was taken on march 18th 1995 - a saturday - so there's a good chance one of the pixels in the picture is me! (thanks for linking to the server, i am now filled with nostalgia gazing at the screen on my laptop!) + mikkel oh, this is where i lived: http://terraserver-usa.com/image.aspx?t=1&s=10&x=1563&y=2276 9&z=17&w=2
|
mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
|
|
|
toxi
|
Re: USGS Images in Processing
« Reply #5 on: Feb 17th, 2004, 7:59pm » |
|
mikkel, what did you do to end up in a detention camp? it certainly looks like it from above... ryan, i really love that idea, looking forward to see what you'll come up with!!
|
http://toxi.co.uk/
|
|
|
|