Retrieving gif data from a RESTful map server

MacBox at earthlink.net MacBox at earthlink.net
Fri Apr 12 16:09:40 EDT 2013


I felt good about this one, but no luck, Mark

Not that you can test it without the API key, but here's a look at the fairly simple code I used (note the long wrapped merge line):

on mouseUp
   set the text of img "traffic" to empty
   set the paintcompression to "PNG"
   put GetAPIKey() into tKey
   put getLat() into tLat
   put getLong() into tLong
   put getWidth() into tWidth
   put getHeight() into tHeight

   put merge("http://www.mapquestapi.com/traffic/v1/flow?key=[[tKey]]&projection=merc&mapLat=[[tLat]]&mapLng=[[tLong]]&mapHeight=[[tHeight]]&mapWidth=[[tWidth]]&mapScale=108335") into tURL

   set the width of img "traffic" to tWidth
   set the height of img "traffic" to tHeight  
   set the text of image "traffic" to url tURL
end mouseUp

If I paste the URL that this creates into a web browser it loads fine.

In desperation I even tried "set the filename of image "traffic" to tURL" as the last line, but it failed as well with the same grey pattern


On Apr 11, 2013, at 20:55 PM, use-livecode-request at lists.runrev.com wrote:

> <MacBox at ...> writes:
> 
>> 
>> I'm attempting to get a traffic gif from mapquest via their RESTful API,
> but I am unable to display it;
>> everything results in the image object displaying a grey pattern.
> 
> Try
> 
> set the paintcompression to "PNG"
> 
> before setting the text (or maybe before getting the gif). There's a known
> problem setting the text of an image if the paintcompression is "RLE", and
> it has that symptom (a gray box). It may be what you're running into.
> 
> -- 
> Mark Wieder
> mwieder at ahsoftware.net




More information about the use-livecode mailing list