The stream is returned but when I write the byte[] on disc it shows X on
image.

The code is as follows.


byte[] buffer = new byte[32 * 1024];

string queryString = "zoom=" + ConfigurationManager.AppSettings["ImageZoom"]
+ "&size=" + ConfigurationManager.AppSettings["Size"] + "&maptype=" +
ConfigurationManager.AppSettings["MapType"] + "&key=" + ConfigurationManager
.AppSettings["Key"] + "&sensor=false&format=" + ConfigurationManager
.AppSettings["Format"] + "&markers=" + drReportRow["GeoCode"].ToString();

Uri uri = new Uri("http://maps.google.com/staticmap?"; + queryString,true);

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);

WebResponse wr = webRequest.GetResponse();

Stream stream = wr.GetResponseStream();

if (stream != null)

{

stream.Read(buffer, 0, buffer.Length);

File.WriteAllBytes(System.IO.Path.GetDirectoryName(System.Web.HttpContext.Current.Request.PhysicalApplicationPath)
+ @"\GoogleImages\test.jpg", buffer);

}


On Wed, Apr 1, 2009 at 11:40 AM, Esa <[email protected]> wrote:

>
>
> > Sometime it gives me image, sometimes not.
> >
>
> What does it give you when it doesn't give an image?
>  >
>


-- 
Best regards,

Haider Ali Khan
Senior Software Engineer
Direct: +92 322 4727563, [email protected]
TEO (Pvt.) Ltd. 3rd Floor, Hassan Arcade, F-11 Markaz, Islamabad, Pakistan,
+92 2112849-50

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to