hi
i try to view my kml files to view on my local pc without hosting it
on a web server but i wont get it.
at first i tried this method but i have to creat that XML file
seperatly and can't get my own icons
function load() {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
GDownloadUrl("data.xml", function(data, responseCode) {
var xml = GXml.parse(data);
var way = xml.documentElement.getElementsByTagName("way");
var points = [];
for (var i = 0; i < way.length; i++) {
var point = new GLatLng(parseFloat(way[i].getAttribute("lat")),
parseFloat(way[i].getAttribute("lng")));
points.push(point);
}
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var point = new
GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
map.addOverlay(new GMarker(point));
}
});
}
and because i already have the kml files it woulb be silly to creat a
xml file with the same content so i tried this
function load() {
var map;
var geoXml;
GDownloadUrl("data.kml", function(data, responseCode) {
if (GBrowserIsCompatible()) {
geoXml = new GGeoXml("c:\data.kml");
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.addMapType(G_SATELLITE_3D_MAP);
map.addOverlay(geoXml);
}
});
}
but i can't use local kml files in this method only kml files on web
servers
i have to get this method work to use my kml file
or to write a kml parser for the first method, but this would be too
difficult for me
does anyone have an idea how to solve my problem? uploding the kml
file to a webserver is no option for me, i want to run it local
> hi
> i try to view my kml files to view on my local pc without hosting it
> on a web server but i wont get it.
> at first i tried this method but i have to creat that XML file
> seperatly and can't get my own icons
> function load() {
> var map = new GMap2(document.getElementById("map"));
> map.addControl(new GSmallMapControl());
> map.addControl(new GMapTypeControl());
> GDownloadUrl("data.xml", function(data, responseCode) {
> var xml = GXml.parse(data);
> var way = xml.documentElement.getElementsByTagName("way");
> var points = [];
> for (var i = 0; i < way.length; i++) {
> var point = new GLatLng(parseFloat(way[i].getAttribute("lat")),
> parseFloat(way[i].getAttribute("lng")));
> points.push(point);
> }
> var markers = xml.documentElement.getElementsByTagName("marker");
> for (var i = 0; i < markers.length; i++) {
> var point = new
> GLatLng(parseFloat(markers[i].getAttribute("lat")),
> parseFloat(markers[i].getAttribute("lng")));
> map.addOverlay(new GMarker(point));
> }
> });
> }
> and because i already have the kml files it woulb be silly to creat a
> xml file with the same content so i tried this
> but i can't use local kml files in this method only kml files on web
> servers
> i have to get this method work to use my kml file
> or to write a kml parser for the first method, but this would be too
> difficult for me
> does anyone have an idea how to solve my problem? uploding the kml
> file to a webserver is no option for me, i want to run it local
Then you can't use GGeoXml. You may be able to use one of the third
party parsers, however, since per the TOU your map _has_ to be public
if you want to use the free Google Maps API, you probably should break
down and get a free web hosting account. Google is nice enough to
allow you to test some things on your local PC.
Seeing as you not allowed to use the API locally it's rather a moot point. But there are other KML parsers available, eg GeoXML or EGeoXML. (You may still need to use a proxy)
On Tue, Oct 7, 2008 at 2:37 PM, Falk <falkhohm...@googlemail.com> wrote:
> hi > i try to view my kml files to view on my local pc without hosting it > on a web server but i wont get it. > at first i tried this method but i have to creat that XML file > seperatly and can't get my own icons
> function load() {
> var map = new GMap2(document.getElementById("map")); > map.addControl(new GSmallMapControl()); > map.addControl(new GMapTypeControl());
> GDownloadUrl("data.xml", function(data, responseCode) { > var xml = GXml.parse(data); > var way = xml.documentElement.getElementsByTagName("way"); > var points = []; > for (var i = 0; i < way.length; i++) { > var point = new GLatLng(parseFloat(way[i].getAttribute("lat")), > parseFloat(way[i].getAttribute("lng"))); > points.push(point); > }
> var markers = xml.documentElement.getElementsByTagName("marker"); > for (var i = 0; i < markers.length; i++) { > var point = new > GLatLng(parseFloat(markers[i].getAttribute("lat")), > parseFloat(markers[i].getAttribute("lng"))); > map.addOverlay(new GMarker(point)); > } > }); > }
> and because i already have the kml files it woulb be silly to creat a > xml file with the same content so i tried this
> but i can't use local kml files in this method only kml files on web > servers
> i have to get this method work to use my kml file > or to write a kml parser for the first method, but this would be too > difficult for me > does anyone have an idea how to solve my problem? uploding the kml > file to a webserver is no option for me, i want to run it local
On Oct 7, 2:37 pm, Falk <falkhohm...@googlemail.com> wrote:
uploding the kml
> file to a webserver is no option for me, i want to run it local
Why is it not an option for you?
Any map you create using the API has to be publicly available on the
web to be viewed by anyone so the code for you map will have to be
uploaded to a web server.
But for *testing* you can use your local PC, but you'll need a web
server running on your PC to do this, so c:\data.kml will not work,
will usually be http://localhost/data.kml
On Oct 7, 6:52 am, Mike in Stroud <mike.be...@stroud.gov.uk> wrote:
> On Oct 7, 2:37 pm, Falk <falkhohm...@googlemail.com> wrote:
> uploding the kml
> > file to a webserver is no option for me, i want to run it local
> Why is it not an option for you?
> Any map you create using the API has to be publicly available on the
> web to be viewed by anyone so the code for you map will have to be
> uploaded to a web server.
> But for *testing* you can use your local PC, but you'll need a web
> server running on your PC to do this, so c:\data.kml will not work,
> will usually behttp://localhost/data.kml
You can test without a webserver on your local PC (using the file:///
protocol).
-- Larry
hi i allready tried the file method and it does not work or did i
something wrong? i dont realy know what to put in the GDownloarUrl
and i the fact why i dont want to use a web server is that i generate
a kml file through a program i have written and want to show it in GE
or GM automaticaly. GE is working fine but not GM.
if (GBrowserIsCompatible()) {
geoXml = new GGeoXml("file:///C:/data.kml");
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.addMapType(G_SATELLITE_3D_MAP);
map.addOverlay(geoXml);
}
});
}
thrid party parsers would be great if u can tell me how to use them or
where i find excamples or a how to
there is still the option with the simple XML parser if u can tell me
if there is an oportunity to user custom icons because now there is no
icon defined and GM is using a standard icon
On Oct 7, 7:39 am, Falk <falkhohm...@googlemail.com> wrote:
> hi i allready tried the file method and it does not work or did i
> something wrong?
Probably. But since it is local and you won't post a legal copy, we
can't tell.
> i dont realy know what to put in the GDownloarUrl
> and i the fact why i dont want to use a web server is that i generate
> a kml file through a program i have written and want to show it in GE
> or GM automaticaly. GE is working fine but not GM.
> thrid party parsers would be great if u can tell me how to use them or
> where i find excamples or a how to
> there is still the option with the simple XML parser if u can tell me
> if there is an oportunity to user custom icons because now there is no
> icon defined and GM is using a standard icon
This is all irrelevant if you aren't going to put it on the web, you
aren't allowed to use the API.
>On Oct 7, 6:52 am, Mike in Stroud <mike.be...@stroud.gov.uk> wrote: >> On Oct 7, 2:37 pm, Falk <falkhohm...@googlemail.com> wrote: >> uploding the kml
>> > file to a webserver is no option for me, i want to run it local
>> Why is it not an option for you? >> Any map you create using the API has to be publicly available on the >> web to be viewed by anyone so the code for you map will have to be >> uploaded to a web server.
>> But for *testing* you can use your local PC, but you'll need a web >> server running on your PC to do this, so c:\data.kml will not work, >> will usually behttp://localhost/data.kml
>You can test without a webserver on your local PC (using the file:/// >protocol).
All the XML parsing is performed by a Google server. The code in the client sends the URL to the server, the server reads the file and sends back a list of things for the client to display.
(I sincerely hope that) Google servers can't read XML files that reside on a local PC unless you run a public webserver.
> >On Oct 7, 6:52 am, Mike in Stroud <mike.be...@stroud.gov.uk> wrote:
> >> On Oct 7, 2:37 pm, Falk <falkhohm...@googlemail.com> wrote:
> >> uploding the kml
> >> > file to a webserver is no option for me, i want to run it local
> >> Why is it not an option for you?
> >> Any map you create using the API has to be publicly available on the
> >> web to be viewed by anyone so the code for you map will have to be
> >> uploaded to a web server.
> >> But for *testing* you can use your local PC, but you'll need a web
> >> server running on your PC to do this, so c:\data.kml will not work,
> >> will usually behttp://localhost/data.kml
> >You can test without a webserver on your local PC (using the file:///
> >protocol).
> All the XML parsing is performed by a Google server. The code in the
> client sends the URL to the server, the server reads the file and sends
> back a list of things for the client to display.
> (I sincerely hope that) Google servers can't read XML files that reside
> on a local PC unless you run a public webserver.
I was (probably incorrectly) talking about testing general maps and
xml data (not GGeoXml...).
> Probably. But since it is local and you won't post a legal copy, we
> can't tell.
legal copy of what?
ok so how is it possible to use another icon for the markers insted of
the standart icon?
or better can i use different icon in the map and when it is possible
how can i do this?