Interactive Mapping Blog

Mapping Solutions News

Archive for the ‘ASP.Net’ Category

Earthware help Rovster launch a new type of property website

Monday, October 26th, 2009

Earthware are delighted to have been invited by Gary McCausland (from BBC1’s “Axe the Agent” to do the web design, web development, interactive mapping and SEO (Search Engine Optimisation) for his new venture Rovster.

Rovster allows a property owner who wants to “sell my house privately” to sign up and advertise online with a free property listing.  Whether you have flats to rent, property to rent or you want to buy a property in … or sell my house in …. then Rovster is seeking to debunk the property market.

We are delighted that not only did Gary decide to integrate Earthware interactive property mapping but also to use our sister, The Technology Studio to do the web design and development.

We wish Gary every success with Rovster!

The Earthware team

Virtual Earth Control 100% height problem – Solved! Well almost

Friday, August 29th, 2008

Ok, so I was using the new asp.net Virtual Earth map control and looking to size it to have a 100% width and height. Like many of you out there I was experiencing the problem that I could only seem to apply the 100% width. As soon as I tried to apply the 100% height the control was not visible when the page loaded.

Well, we here at Earthware have continued to work at the problem and have managed to come up with a solution. If you put the map control within a div which is positioned absolute and has a height and width of 100% itself, then you should see it works as required. See below…

<div style="position:absolute;width:100%;height:100%;">
    <ve:Map ID="Map1" runat="server" Height="100%" Width="100%"
    ZoomLevel="4" onserverloadmap="Map1_ServerLoadMap"
    OnClientLoadMap="Map1_ClientLoadMap"
    OnClientResize="Map1_ClientLoadMap" />
</div>

However, as always things are not quite that simple!! From what we can see this works in Internet Explorer 7 and Firefox 3, but not in earlier versions of these browsers. We’ve therefore come up with a semi fix for this. If you set the height and width using the Map.Resize method in the code behind then this works on initial page load. We’ve used some javascript and hidden fields in the code in front to get the correct height and width, as below…

CODE IN FRONT:

<script type="text/javascript">
 function Map1_ClientLoadMap(sender, e)
 {
     if (document.documentElement &&
        (document.documentElement.clientWidth ||
         document.documentElement.clientHeight))
     {
       //For the fix for IE 6 and Firefox versions less than 3
       $get("clientwidth").value = document.documentElement.clientWidth;
       $get("clientheight").value = document.documentElement.clientHeight;
     }
 }
</script>

CODE BEHIND:

protected void Map1_ServerLoadMap(object sender, EventArgs e)
{
    ResizeMap();
}

private void ResizeMap()
{
    if (Request.Browser.Type == "IE6" ||
       (Request.Browser.Browser == "Firefox" &&
        Request.Browser.MajorVersion < 3))
    {
        Map1.Resize(Convert.ToInt16(clientwidth.Value), 
                    Convert.ToInt16(clientheight.Value));
    }
}

Unfortunately at this time we cannot get the resize events to work (the Resize event only fires if you manually resize the control, not if you resize the browser window) but do check back again soon as we are continuing to work on this.

Please download an example of a working case to of all of the above in action.

We’re hiring!

Tuesday, October 30th, 2007

That’s right Earthware are continuing to expand beyond our expectations so we are looking for an experiences asp.net web developer. Earthware is an innovative small start-up company where individuals can really make a difference. If you are a quick learner and keen to pickup new and exciting skills and experience then why not apply today.

For the full details of the role please click here.

Writing KML & KMZ files to the browser with ASP.Net

Wednesday, August 9th, 2006

Over the last few weeks we have been busy finishing of various demos including our upcomming uk cinemas demo. During development we’ve come across a few ‘issues’ with writing KML an KMZ files to the users browser from an .aspx page using the “Content-Disposition” HTTP Header that I thought it would be helpful to share with other .Net Google Earth developers who may come acrross the same problems.

ALL the problems are due to Internet explorer! Firefox works perfectly all the time ;-) It seems I suffers from a number of problems, our specific ones being:

  1. IE often has problems honouring AddHeader(“Content-Disposition”,”attachment; filename=myfile.kmz”) and instead prompts the user to open a file called the same as the .aspx page they are on.
  2. IE also has problems actually downloading the file once you have the filename comming up ok, complaining about not being able to contact the internet site. Bizarely the page works fine it you follow a link to it from another page, but not if your enter the url directly into the address bar?

Both solutions in the end were simple, but not obvious

  1. If, just like us, you have IIS setup to compress all .aspx files (Gzip compression) then each .aspx request has a header “Content-Encoding: gzip” that IIS adds for you. Unfortunatly IE then ignores your “Content-Disposition” header, so to fix it add Response.AppendHeader(“Content-Encoding”, “none;”) and then it works!
  2. This one is even simplier, but we have not idea why this works. Just add Response.ClearHeaders() and the file will work properly from a direct url

So other than now having a bigger hate for IE, its all working. We hope to have some of the first demos live soon.