C# .NET - Google Map KML file in Asp.Net

Asked By Shailendrasinh Parmar
02-Feb-10 09:07 AM
I am creating KML file for google maps, and the file is generating properly in the same directory. But When I use it in my page, it doesn't show proper map.

Here is my code in javascript 

function init()
                {
                    if (GBrowserIsCompatible()) {
                    
                    geoXml = new GGeoXml("http://localhost:1546/Website1/myKML.kml");
                    //geoXml = new GGeoXml("http://www.spencerwilliams.net/kml/kmltest3.xml");
   map = new GMap2(document.getElementById("map_canvas"));
                    map.setCenter(new GLatLng(0,0),0);      
                    map.addControl(new GLargeMapControl());
                    map.addControl(new GLargeMapControl());
                    map.addOverlay(geoXml);
                    map.setCenter(geoXml.getDefaultCenter()); 
                    geoXml.gotoDefaultViewport(map);
                  }
                }

This function is being called on Body's onload event.

When I used following statement in it, the map was showing proper locations.

//geoXml = new GGeoXml("http://www.spencerwilliams.net/kml/kmltest3.xml");

Can anybody guide me further please, Peter sir and Mr. Robbe Morris?

Thanks in Advance..
  Sean * replied to Shailendrasinh Parmar
02-Feb-10 12:20 PM
Would it be possible to post your "myKML.kml" here or link to it, as you say the code you posted works already.

I'm neither Peter nor Mr. Robbe Morris.  I'm neither Peter nor Mr. Robbe Morris.

02-Feb-10 02:55 PM
However, in my opinion, the KML url that you are using needs to available on the internet, as it is processed by the Google Servers before the browser processes it. So the localhost url's are skipped.

There is an explanation provided http://markmail.org/message/ue7ryhjrftmanfvi.
  Shailendrasinh Parmar replied to Sean *
02-Feb-10 11:52 PM
Hello, Here is the content of mykml.kml

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
  <Document>
    <Placemark>
      <name>Lowes #3</name>
      <styleUrl>root://styleMaps#default+nicon=0x447+hicon=0x457</styleUrl>
      <Point>
        <coordinates>82.831893,39.920836,0</coordinates>
      </Point>
      <LookAt>
        <longitude>82.831893</longitude>
        <latitude>39.920836</latitude>
        <longitude>45.000000</longitude>
      </LookAt>
    </Placemark>
    <Placemark>
      <name>Lowes #9</name>
      <styleUrl>root://styleMaps#default+nicon=0x447+hicon=0x457</styleUrl>
      <Point>
        <coordinates>82.741163,40.363952,0</coordinates>
      </Point>
      <LookAt>
        <longitude>82.741163</longitude>
        <latitude>40.363952</latitude>
        <longitude>45.000000</longitude>
      </LookAt>
    </Placemark>
    <Placemark>
      <name>Lowes #16</name>
      <styleUrl>root://styleMaps#default+nicon=0x447+hicon=0x457</styleUrl>
      <Point>
        <coordinates>87.480207,37.334623,0</coordinates>
      </Point>
      <LookAt>
        <longitude>87.480207</longitude>
        <latitude>37.334623</latitude>
        <longitude>45.000000</longitude>
      </LookAt>
    </Placemark>
    <Placemark>
      <name>Lowes #22</name>
      <styleUrl>root://styleMaps#default+nicon=0x447+hicon=0x457</styleUrl>
      <Point>
        <coordinates>76.43317,40.298283,0</coordinates>
      </Point>
      <LookAt>
        <longitude>76.43317</longitude>
        <latitude>40.298283</latitude>
        <longitude>45.000000</longitude>
      </LookAt>
    </Placemark>
  </Document>
</kml>
Create New Account
help
how to show directions in google map by vb.net Hi. i am working on a windows application in vb.net i hav a web browser in my application for showing up the directions in google map. i want to show the directions between 2 points . below is the url of the same http: / / maps.google.com / maps?q = PARMA +ID, +to+PHILADELPHIA +PA, view = map&pw = 2 but i also want to show the direction between 2 points(A, 9
Server Common UtilFileSystem 0 Monitorable CopyPattern: Skipped copy of file 'C: \ Program Files \ Microsoft Office Servers \ 12.0 \ Data \ Office Server \ Config \ noiseara.txt' b / c the target 'C: \ Program Files \ Microsoft Office Servers \ 12.0 \ Data \ Office Server \ Applications \ ea0740f6-ed4e-42d9-b75c-e7dec57c815e \ Config \ noiseara.txt' already Server Common UtilFileSystem 0 Monitorable CopyPattern: Skipped copy of file 'C: \ Program Files \ Microsoft Office Servers \ 12.0 \ Data \ Office Server \ Config \ noiseben.txt' b / c the target 'C: \ Program Files \ Microsoft Office Servers \ 12.0 \ Data \ Office Server \ Applications \ ea0740f6-ed4e-42d9-b75c-e7dec57c815e \ Config \ noiseben.txt' already Server Common UtilFileSystem 0 Monitorable CopyPattern: Skipped copy of file 'C: \ Program Files \ Microsoft Office Servers \ 12.0 \ Data \ Office Server \ Config \ noisebul.txt' b / c the target 'C: \ Program Files \ Microsoft Office Servers \ 12.0 \ Data \ Office Server \ Applications \ ea0740f6-ed4e-42d9-b75c-e7dec57c815e \ Config \ noisebul.txt' already Server Common UtilFileSystem 0 Monitorable CopyPattern: Skipped copy of file 'C: \ Program Files \ Microsoft Office Servers \ 12.0 \ Data \ Office Server \ Config \ noisecat.txt' b / c the target 'C: \ Program Files \ Microsoft Office Servers \ 12.0 \ Data \ Office Server \ Applications \ ea0740f6-ed4e-42d9-b75c-e7dec57c815e \ Config \ noisecat.txt' already
is not clear View about where the One Post Ends when click "All Posts" link Thanks previous full width view was better because some line of code include long length strings nice, congratulation for new design, i think search option is missing from old version Hi Robbe, One suggestion, the forum reply is completeley to the right corner , It was better below I wish the reply button would be nearer to navigate Hi Robbe, Another issue Clicking on Edit i thought would give a change to current post, but Navigation menu missing in forum merit page http: / / www.eggheadcafe.com / forummerit.aspx Regards Hi Robbe, I suggest you that, if you remove footer below(i.e. which contains of twitter Ismael on 17-Oct-11 in ASP.NET . 4 Replies How to make GeoFence in google map using c# ( 0 views ) Submitted By balaji mogadali on 17-Oct-11 in ASP.NET are added , it would be better to use some seperation between each Answer posted Hi Robbe, After giving replay for the question and submitting the button, page is showing the top 6ddb-4cef-8793-24ede32a4c12 / find- -the-controls-in-a-webform-page-using-jquery.aspx Hi Robbe, If the replay link is below the question , it will be easy to the users
to use google map in c# http: / / ranahareesh.practo.com can u tell how to get the following functionalities in goole map please tell if u know Just follow steps. Step 1: Create a new website > select to this site and give your URL in click on Generate API Key. http: / / code.google.com / apis / maps / signup.html Copy this Key and paste in some document. . Step 6: Now add this lines of lines of code in .aspx page We are using Google Marker to indicate your location. Zoom can be set until 9. Step 7: Now Lets help! but bro i ma talking about the locating method . . . . . . . . . . . . . . . . Ever wanted to add a Google Map to your site but only had 15 minutes to spare? Now you can add a