comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » using IDLnetURL to get an image from a HTTP URL into IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
using IDLnetURL to get an image from a HTTP URL into IDL [message #91365] Mon, 06 July 2015 01:01 Go to next message
Puneeth Shankar is currently offline  Puneeth Shankar
Messages: 21
Registered: June 2015
Junior Member
I was hoping for some help on ways to get an image(say a screen shot of google maps) from a URL and save it onto the hard disk.
Currently I'm able to :
1)Save the entire http code of a URL to disk(if I want to)
2)Save an image from "URls' that straightly lead to images" for ex: ( http://d335hnnegk3szv.cloudfront.net/wp-content/uploads/site s/501/2014/11/Balloons21.jpg )
Note: Using the below snippet will give you an idea of what i have achieved so far:

Url = ' http://chart.apis.google.com/chart?chs=200x100&cht=p& ;chd=t:10,20,30'
ourl = obj_new('IDLnetURL')
png = ourl->get(filename='E:\temp\gchart.png', url=url)
obj_destroy, ourl
im = read_png('gchart.png')
window, xsize=200, ysize=100
tv, im, true=1
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91366 is a reply to message #91365] Mon, 06 July 2015 01:27 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, July 6, 2015 at 10:01:40 AM UTC+2, Puneeth Shankar wrote:
> I was hoping for some help on ways to get an image(say a screen shot of google maps) from a URL and save it onto the hard disk.
> Currently I'm able to :
> 1)Save the entire http code of a URL to disk(if I want to)
> 2)Save an image from "URls' that straightly lead to images" for ex: ( http://d335hnnegk3szv.cloudfront.net/wp-content/uploads/site s/501/2014/11/Balloons21.jpg )
> Note: Using the below snippet will give you an idea of what i have achieved so far:
>
> Url = ' http://chart.apis.google.com/chart?chs=200x100&cht=p& ;chd=t:10,20,30'
> ourl = obj_new('IDLnetURL')
> png = ourl->get(filename='E:\temp\gchart.png', url=url)
> obj_destroy, ourl
> im = read_png('gchart.png')
> window, xsize=200, ysize=100
> tv, im, true=1

Hi,
I don't understand your question. What was the question again?
If you want to display and save the image AND you have idl version 8.xx then
I would use the following lines:

i = image(im, dimensions=[200,100], margin=0, /no_toolbar)
i.save, 'gchart.jpg', width=200

The save method allows saving in lots of formats, see http://www.exelisvis.com/docs/save_method.html

The thing is, you already have a save image, so I don't think that this is what you're looking for.

If you're trying to get images from google maps, you should have a look at David's article: http://www.idlcoyote.com/map_tips/googlemap.php
(for this, and many other applications, you will need David's Coyote library)

I hope this helps (but I doubt it).

Cheers, Helder
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91367 is a reply to message #91366] Mon, 06 July 2015 12:19 Go to previous messageGo to next message
Puneeth Shankar is currently offline  Puneeth Shankar
Messages: 21
Registered: June 2015
Junior Member
Hi Helder,
Re. "IDLnetURL" as shown in the snippet above, my concern is to get an image from a remote server using a URL. I'm half way through actually. Meaning that I can now download and store an image from only such URLs; which upon opening via a browser, one can notice that it will contain only an image(no associated text/paragraphs etc).
Here's my requirement: I'm hoping to download only images from normal URLs that contain both text and images.Let me know your thoughts on this. I appreciate your time and patience.Thanks for replying :)

Kind Regards,
PUNEETH
puneeth89@gmail.com
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91369 is a reply to message #91367] Mon, 06 July 2015 14:53 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 7/6/15 1:19 PM, Puneeth Shankar wrote:
> Hi Helder, Re. "IDLnetURL" as shown in the snippet above, my concern
> is to get an image from a remote server using a URL. I'm half way
> through actually. Meaning that I can now download and store an image
> from only such URLs; which upon opening via a browser, one can notice
> that it will contain only an image(no associated text/paragraphs
> etc). Here's my requirement: I'm hoping to download only images from
> normal URLs that contain both text and images.Let me know your
> thoughts on this. I appreciate your time and patience.Thanks for
> replying :)
>
> Kind Regards, PUNEETH puneeth89@gmail.com
>

I'm not entirely sure of your question, but my guess is that you are
trying to do something like what a web browser does? i.e. download an
.html file which has URL references to various image files?

If that is correct, then you need to make multiple requests via
IDLnetURL. Get the .html file via IDLnetURL, parse the HTML file to find
the img tags, and then download the associated images.

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91370 is a reply to message #91367] Mon, 06 July 2015 17:43 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Monday, July 6, 2015 at 3:19:41 PM UTC-4, Puneeth Shankar wrote:
> Hi Helder,
> Re. "IDLnetURL" as shown in the snippet above, my concern is to get an image from a remote server using a URL. I'm half way through actually. Meaning that I can now download and store an image from only such URLs; which upon opening via a browser, one can notice that it will contain only an image(no associated text/paragraphs etc).
> Here's my requirement: I'm hoping to download only images from normal URLs that contain both text and images.Let me know your thoughts on this. I appreciate your time and patience.Thanks for replying :)

IDL is not the best tool for this. "Normal URLs" as you call them, are links to full HTML pages. HTML can be very complicated and IDL cannot parse them without difficulty.

Wget is a better option because it is able to parse static HTML pages and download all of the linked images.

Wget probably will not handle something like Google Maps because map tiles are loaded dynamically within the browser using Javascript. I personally think your best bet is to run a virtual machine or virtual display, and run a browser within that virtual environment which you remotely control. It won't be easy, but can be done by an experienced developer.

You could also hire someone to make screenshots for you. :-)

CM
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91371 is a reply to message #91369] Tue, 07 July 2015 02:49 Go to previous messageGo to next message
Puneeth Shankar is currently offline  Puneeth Shankar
Messages: 21
Registered: June 2015
Junior Member
Thanks Mike! I'm looking to download the top right corner image,a map that is ! (refer below url) https://www.dropbox.com/s/q1ow2rh08ortoby/DM.PNG?dl=0
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91372 is a reply to message #91371] Tue, 07 July 2015 03:08 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Tuesday, July 7, 2015 at 11:49:39 AM UTC+2, Puneeth Shankar wrote:
> Thanks Mike! I'm looking to download the top right corner image,a map that is ! (refer below url) https://www.dropbox.com/s/q1ow2rh08ortoby/DM.PNG?dl=0

Looking at Michael and Craig's suggestions, you can do two things:
1) download the html and look inside for the reference to the image. All browsers allow you to have a look at the html (source). To do this in chrome simply click ctrl-u and a new page will open. In html (this might not be the case), images are tagged with "<img". Read any html tutorial for more info. Parse the html file as Michael said to locate the image and maybe you'll be lucky. It could be that the image is "hidden" in the code...

2) Craig suggested using wget. If you're on linux, that should not be a problem, but if you're on windows you can look for a wget for windows (google that and you'll find some free solutions). From idl you can use the spawn command to interact with the shell and launch wget and retrieve the images.

Good luck!
Helder
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91378 is a reply to message #91371] Tue, 07 July 2015 09:33 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 7/7/15 3:49 AM, Puneeth Shankar wrote:
> Thanks Mike! I'm looking to download the top right corner image,a map
> that is ! (refer below url)
> https://www.dropbox.com/s/q1ow2rh08ortoby/DM.PNG?dl=0
>

This quickly gets beyond the scope of what you want to do. That slippy
map is powered by Javascript which is making its own calls to get the
map tiles it is displaying.

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91383 is a reply to message #91378] Tue, 07 July 2015 22:47 Go to previous messageGo to next message
Puneeth Shankar is currently offline  Puneeth Shankar
Messages: 21
Registered: June 2015
Junior Member
Hi Mike and Helder,
I have access to the ortho images,also there's Google static maps.Is the same feasible in IDL? If you can give me a breakup of the associated tasks, It will really give me a sense if i'm heading the right way.Thanks for your time :)

Regards,
Puneeth
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91385 is a reply to message #91383] Wed, 08 July 2015 00:37 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Wednesday, July 8, 2015 at 7:47:57 AM UTC+2, Puneeth Shankar wrote:
> Hi Mike and Helder,
> I have access to the ortho images,also there's Google static maps.Is the same feasible in IDL? If you can give me a breakup of the associated tasks, It will really give me a sense if i'm heading the right way.Thanks for your time :)
>
> Regards,
> Puneeth

Did you look at this:
http://www.idlcoyote.com/map_tips/googlemap.php

Cheers,
Helder
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91396 is a reply to message #91385] Wed, 08 July 2015 11:21 Go to previous messageGo to next message
Puneeth Shankar is currently offline  Puneeth Shankar
Messages: 21
Registered: June 2015
Junior Member
I did write something close to it.Using Geographic corners from the metadata, I make IDL pick Google static maps via URLs which I designed to highlight the Geographic Extent using polyline & Fluorescent fill. I initially didn't know how to deal with objects.Thanks to Michael Galloy for awesome examples from his book.Thanks to all you guys for helping me out.

https://maps.googleapis.com/maps/api/staticmap?zoom=14&s ize=300x300&maptype=terrain&scale=1&path=color:0 xff0000ff|weight:2|fillcolor:0xFFFF0033|41.40294444,-82.3994 2778|41.40294444,-82.39476389|41.39868056,-82.39476389|41.39 868056,-82.39942778|41.40294444,-82.39942778
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91494 is a reply to message #91378] Tue, 21 July 2015 03:37 Go to previous messageGo to next message
Puneeth Shankar is currently offline  Puneeth Shankar
Messages: 21
Registered: June 2015
Junior Member
Hi Mike,
Would you happen to know how to grab corner lat longs from a geotiff image?
Currently, I'm able to get just one such point from the tiff structure "MODELTIEPOINTTAG".
Ex: print,tiff_tags.MODELTIEPOINTTAG
0.00000000 0.00000000 0.00000000 -82.399429 41.402946 0.00000000

These lat-longs are essential for google static maps to draw a bounding box over the 250x250 map headlessly.

Regards,
Puneeth
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91504 is a reply to message #91494] Tue, 21 July 2015 14:20 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 7/21/15 4:37 AM, Puneeth Shankar wrote:
> Hi Mike,
> Would you happen to know how to grab corner lat longs from a geotiff image?
> Currently, I'm able to get just one such point from the tiff structure "MODELTIEPOINTTAG".
> Ex: print,tiff_tags.MODELTIEPOINTTAG
> 0.00000000 0.00000000 0.00000000 -82.399429 41.402946 0.00000000
>
> These lat-longs are essential for google static maps to draw a bounding box over the 250x250 map headlessly.
>
> Regards,
> Puneeth
>

Checkout this page:

http://www.remotesensing.org/geotiff/spec/geotiff2.6.html

If you only have a single tie point, I think it is indicating that it is
a simple affine transformation. Use the ModelPixelScaleTag to determine
the other corner.

--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91509 is a reply to message #91504] Wed, 22 July 2015 11:29 Go to previous messageGo to next message
Puneeth Shankar is currently offline  Puneeth Shankar
Messages: 21
Registered: June 2015
Junior Member
Thanks for your time on this Mike.
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91890 is a reply to message #91504] Tue, 08 September 2015 22:59 Go to previous message
lakshmi prasanna is currently offline  lakshmi prasanna
Messages: 1
Registered: September 2015
Junior Member
Hai Mike

I am lakshmi, i am trying to write a program for crop area acreage estimation of certain area is it possible to implement code using idl.

i am very new to idl programming, if your having any materials regarding idl programming please share it to me

regards,
T.Lakshmi Prasanna.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Double precision data into caldat
Next Topic: lambda functions in IDL-python bridge

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:13:54 PDT 2025

Total time taken to generate the page: 0.00504 seconds