Working KML example - Can I work on a local KML file

69 views
Skip to first unread message

Noelette

unread,
Aug 6, 2011, 11:03:14 AM8/6/11
to google-map...@googlegroups.com
I'm currently working on a local machine - I've not moved anything to the server yet. I want to create a KML file with a number of placemarkers like in Googles own example http://code.google.com/apis/maps/documentation/javascript/examples/layer-kml-features.html 
However when I take the source code but change the KML file URL to kml file in the same directory as the source code no marker is displayed. (I'm using the centre point of the map as the test maker I want to display)
MY KML looks like this

<kml xmlns="http://www.google.com/earth/kml/2">
<Placemark>
  <name>Library</name>
  <description>Main Campus</description>
  <Point>
    <coordinates>40.65, -73.95, 0</coordinates>
  </Point>
</Placemark>
</kml>
Any help would be much appriciated! 

geoco...@gmail.com

unread,
Aug 6, 2011, 4:09:16 PM8/6/11
to Google Maps JavaScript API v3
On Aug 6, 8:03 am, Noelette <noelettehur...@gmail.com> wrote:
> I'm currently working on a local machine - I've not moved anything to the
> server yet. I want to create a KML file with a number of placemarkers like
> in Googles own example
http://code.google.com/apis/maps/documentation/javascript/examples/la...
>
> However when I take the source code but change the KML file URL to kml file
> in the same directory as the source code no marker is displayed. (I'm using
> the centre point of the map as the test maker I want to display)


Your KML file must be publicly accessible to use KmlLayer (Google's
servers need to fetch it).

Your test page can be on a local machine, not on the web, but the kml
file must be on the web.

-- Larry

geoco...@gmail.com

unread,
Aug 6, 2011, 4:22:47 PM8/6/11
to Google Maps JavaScript API v3
On Aug 6, 1:09 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Aug 6, 8:03 am, Noelette <noelettehur...@gmail.com> wrote:> I'm currently working on a local machine - I've not moved anything to the
> > server yet. I want to create a KML file with a number of placemarkers like
> > in Googles own example
>
> http://code.google.com/apis/maps/documentation/javascript/examples/la...
>
>
>
> > However when I take the source code but change the KML file URL to kml file
> > in the same directory as the source code no marker is displayed. (I'm using
> > the centre point of the map as the test maker I want to display)
>
> Your KML file must be publicly accessible to use KmlLayer (Google's
> servers need to fetch it).
>
> Your test page can be on a local machine, not on the web, but the kml
> file must be on the web.

See:
http://code.google.com/apis/maps/documentation/javascript/overlays.html#KMLLayers

Which states:
+ These data formats are displayed on a map using a KmlLayer object,
whose constructor takes
+ the URL of a *publicly accessible* KML or GeoRSS file.

(note the *publicly accessible*)

Noelette

unread,
Aug 10, 2011, 12:24:04 PM8/10/11
to Google Maps JavaScript API v3
Thank you, I knew I had missed something vital. I've moved the files
in to the public HTML folder and still no marker. Would I be correct
in assuming that I need to change the access permissions to the file..

Thanks again

Noelette

On Aug 6, 9:22 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Aug 6, 1:09 pm, "geocode...@gmail.com" <geocode...@gmail.com>
> wrote:
>
>
>
>
>
>
>
>
>
> > On Aug 6, 8:03 am, Noelette <noelettehur...@gmail.com> wrote:> I'm currently working on a local machine - I've not moved anything to the
> > > server yet. I want to create a KML file with a number of placemarkers like
> > > in Googles own example
>
> >http://code.google.com/apis/maps/documentation/javascript/examples/la...
>
> > > However when I take the source code but change the KML file URL to kml file
> > > in the same directory as the source code no marker is displayed. (I'm using
> > > the centre point of the map as the test maker I want to display)
>
> > Your KML file must be publicly accessible to use KmlLayer (Google's
> > servers need to fetch it).
>
> > Your test page can be on a local machine, not on the web, but the kml
> > file must be on the web.
>
> See:http://code.google.com/apis/maps/documentation/javascript/overlays.ht...

geoco...@gmail.com

unread,
Aug 10, 2011, 6:15:21 PM8/10/11
to Google Maps JavaScript API v3
On Aug 10, 9:24 am, Noelette <noelettehur...@gmail.com> wrote:
> Thank you, I knew I had missed something vital. I've moved the files
> in to the public HTML folder and still no marker. Would I be correct
> in assuming that I need to change the access permissions to the file..

The most common problem is that the server isn't configured to serve
kml files (I use a .xml extension on the http://www.geocodezip.com
server because it doesn't allow .kml files to be served)

What happens if you enter the public url of the kml file into your
browser? (you haven't followed the posting guidelines and provided a
link to your map or your kml so we can do that... I know you have
indicated you are on a local machine, but it is much easier to help
you if you follow the posting guidelines and make everything public)

-- Larry

Saint Byte

unread,
Aug 11, 2011, 3:30:20 AM8/11/11
to Google Maps JavaScript API v3
U ьгые specify full URL to KML file , if u specify not full url - its
not working

On Aug 7, 2:09 am, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:

Noelette

unread,
Aug 11, 2011, 6:53:01 AM8/11/11
to Google Maps JavaScript API v3
Update

New link to map http://cs1.ucc.ie/~nmh2/uccMap.html
Making the kml file xml helps - however for some reason the marker
that should be over UCC is in the artic
link to xml/kml file http://cs1.ucc.ie/~nmh2/mapPoints.xml

I've tried reversing the lat long values.

Any Ideas?
Cheers Noelette

On Aug 10, 11:15 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Aug 10, 9:24 am, Noelette <noelettehur...@gmail.com> wrote:
>
> > Thank you, I knew I had missed something vital. I've moved the files
> > in to the public HTML folder and still no marker. Would I be correct
> > in assuming that I need to change the access permissions to the file..
>
> The most common problem is that the server isn't configured to serve
> kml files (I use a .xml extension on thehttp://www.geocodezip.com

Noelette

unread,
Aug 11, 2011, 6:10:25 AM8/11/11
to Google Maps JavaScript API v3
Link to Map http://cs1.ucc.ie/~nmh2/placeMarks.html
If I try to link to the kml file directly I get

Forbidden

You don't have permission to access /~nmh2/placeMarks.kml on this
server.

I thought I had set the permissions on the kml file to all, so I'm not
sure why I'd get a forbidden error
I'll try using an xml file.

Thank you for the help.

Noelette

On Aug 10, 11:15 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Aug 10, 9:24 am, Noelette <noelettehur...@gmail.com> wrote:
>
> > Thank you, I knew I had missed something vital. I've moved the files
> > in to the public HTML folder and still no marker. Would I be correct
> > in assuming that I need to change the access permissions to the file..
>
> The most common problem is that the server isn't configured to serve
> kml files (I use a .xml extension on thehttp://www.geocodezip.com

Rossko

unread,
Aug 11, 2011, 3:35:52 PM8/11/11
to Google Maps JavaScript API v3
> New link to maphttp://cs1.ucc.ie/~nmh2/uccMap.html
> Making the kml file xml helps - however for some reason the marker
> that should be over UCC is in the artic
...
> I've tried reversing the lat long values.

Look again now. When you use KmlLayer your KML is cached at Google,
including any errors. If you fix the errors in KML but don't take any
special cache-circumventing action, you will still see the error on
the map for some hours.

geoco...@gmail.com

unread,
Aug 11, 2011, 6:50:29 PM8/11/11
to Google Maps JavaScript API v3
On Aug 11, 3:10 am, Noelette <noelettehur...@gmail.com> wrote:
> Link to Maphttp://cs1.ucc.ie/~nmh2/placeMarks.html
> If I try to link to the kml file directly I get
>
> Forbidden
>
> You don't have permission to access /~nmh2/placeMarks.kml on this
> server.
>
> I thought I had set the permissions on the kml file to all, so I'm not
> sure why I'd get a forbidden error

Your server probably isn't configured to serve kml files.

> I'll try using an xml file.

The xml files works for me:
http://cs1.ucc.ie/~nmh2/mapPoints.xml

I seem to see three markers. I do see what looks to be an extra space
in the <coordinates> for one of your markers, that could cause
problems (spaces are used between coordinate groups, and are not
allowed within the Longitude,Latitude,Altitude triplet).

-- Larry
Reply all
Reply to author
Forward
0 new messages