Getting KML map api response as java script source - google-maps

I have called this url http://maps.google.com/maps?f=d&hl=en&saddr=60012& daddr=500+NORTHWEST+HWY,+CARY,+IL,+60013&ie=UTF8&0&om=0&output=kml&sensor=false instead of getting KML response I am getting it as full javascript source. I am really confused with that. Could any one help me out from this issue.

This way of extracting the Google Directions from Google by parsing the KML file is no longer available since 27 July 2012 (because Google has changed the structure of retrieving Google Directions, now you can only get it by JSON or XML), it is time to migrate your code to JSON instead of KML.
See the answer (for Android, but I guess you can work it out for BlackBerry) in my own question here.

Related

Google Maps will not load KML layer from my site

I have a site that contains kml. The kml is shown as a layer in Google Maps. The maps are on the same site. Until recently (may 12th), this worked fine, but now it stopped working. The kml itself is OK, it can be used in Google Earth. When I copy the kml to another site I can load it in Google Maps without any problem.
Is it possible that my site is on a "blacklist" for some reason? Traffic is low. I did not use an API key. I do now but that did not solve the problem.
You can see the difference here:
1 - with kml from my site
2 - with kml placed elsewhere
The first one fails, the second one works. The kml placed elsewhere is an exact copy of the kml from my site. The kml from my site is served with media-type application/vnd.google-earth.kml+xml. It is dynamically generated.
In my case i got FETCH_ERROR on kml status-
Because my site allow only tls 1.2 secure connection.
When i put the files on another server- it's work.
Update 1-
It happend again after sometime, this time use the same domain helped.
from the Google Maps documentation
From February 2015, maps created in the classic Google Maps — https://maps.google.com/ — will no longer load KML/KMZ files from external websites. However, we know that KML files are a really useful way to work with geographic data, so we’ve added KML to Google My Maps, and continue to support this format with other Google Maps APIs. We hope that one of these options will meet your needs.
Both are valid, the one that doesn't works returns a KmlStatus of FETCH_ERROR. As a guess, I would say that the dynamic generation is taking too long. But there might be some security on your server that is preventing Google's server from fetching it.
from the documentation
FETCH_ERROR The document could not be fetched.
from your site
doesn't work with Google Map KmlLayer
Returns KmlStatus: FETCH_ERROR
Works through a proxy with the third party parser geoxml3
placed elsewhere
works with Google Maps KmlLayer
The problem automagically solved itself by waiting a few days. We can only guess what caused it, maybe a temporary glitch on our server which caused Google to stay away for a while and/or sploil it's cache. Anyhow, thanks for the reactions, at least I learned something about testing my kml.

Web-based conversion shp to json

I'm currently working on a school project that implements Google Maps overlayed with data stored in shapefiles and a xml file with a bitmap in it and the WGS coordinates where the image should be overlayed.
The web application that needs to be build requires that a user uploads these raw files, and the result should be visible in the Google Maps.
Is there any way to convert these shapefiles to .json, using PHP or javascript, and get the coordinates stored in the .xml file to get the WGS coordinates. This needs to be done web-based, so stand-alone tools and software won't be sufficient.
These coordinates and .json files than need to be stored in a database, and these records will be used to put on the Google Maps with the appropriate overlays on the resulted coordinates.
Thank you in advance.
All of the processing will need to be done on the server side. I was able to find a shapefile reader class written in php here,
http://www.phpclasses.org/package/1741-PHP-Read-vectorial-data-from-geographic-shape-files.html
It sounds like you have a pretty decent handle on how you need to go about solving the rest of the problem from there.
js-shapefiles-to-geojson script renders shapefiles and dbf files entirely on the client-side, in the browser.
repo: https://github.com/wavded/js-shapefile-to-geojson
demo: http://wavded.github.io/js-shapefile-to-geojson/

how to parse json response from google map api?

how to parse json response that we get from google map api and how can we show the particular location on map.
suppose i have entered one location name(i.e NewYork) and for that i have received json response,how can i show it on the map.
please provide help as i have never used google map api and json also.
Whole bunch of examples here: http://code.google.com/apis/maps/documentation/javascript/v2/demogallery.html
My advice? Find the simplest one closest to what you want to do and view source.
Edit: missed the j2me tag. This advice is inapplicable. Sorry about that.

'GOverlay is undefined' javascript error in IE 7, in spite of having loaded the Google Maps API

Despite loading the Google Maps API, via this url:
http://maps.gstatic.com/intl/en_ALL/mapfiles/276b/maps2.api/main.js
I'm getting the above error.
Why is it that when I download that URL in my browser and do a find for 'GOverlay' I'm getting zero matches?
Have Google removed this from their API or something, causing all my code to break?
GOverlay is an essential part of the Google Maps API implementation, see the V2 documentation for GOverlay here.
The reason for you not finding "GOverlay" when searching through the Javascript file you provided is simply that the Google Maps API consists of several Javascript files, not all of the code is in main.js. Additionally the code is obfuscated which could mean the build GOverlay by concatenating some crazy strings.
On a basic note: Why do you want to use some static JS file? The offical way to use the Google Maps API is using a key, which you have to obtain by registering with your Google account. So actually the URL you should be using is:
http://maps.google.com/maps?file=api&v=2&key=abcdefg
Or use the AJAX loader as seen on the Google Maps V2 documentation here.
The code is actually loaded asynchronously.
Post a link to your page - it is more than likely that there's some issue with your code.

Google Maps kml files

If I use an embeded google map in my website, will the data contained in an kml displayed be publicly viewable?
Will it be possible for the user to access just the data displayed (i.e., not the user interface) or would I have to provide that separately?
If you load your KML through the API, with GGeoXml(), (V2), or KmlLayer(), (V3), then your data needs to be in a public server because it is parsed by Google's servers and they need to be able to get to it. If you load it with a third party extension then you can keep it private.
Third party extensions that can load and parse KML data are EGeoXml() by Mike Williams
http://econym.org.uk/gmap/extensions.htm#EGeoXml
and GeoXml() by Lance Dyas
http://www.dyasdesigns.com/geoxml/
but I believe that both of those are only available for the API V2 for now.
I just upgraded my Google Maps JavaScript API Application from v2 to v3, following these instructions.
My v2 application was using the EGeoXml extension referred to by #Marcelo in the accepted answer to locally parse KML data.
A substitution of geoxml3 in its place, as suggested by #geocodezip (a contributor to the project) in a comment, functioned immediately in my v3 application.
No, the data will not be public. I'm not sure about your other question though.