Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting the entire Google maps web page source instead of just the generated KML file to parse
    primarykey
    data
    text
    <p>I have developed an Android application that uses the Google maps and draws a route path from point A to B on the map. I have used the methods mentioned in <a href="https://stackoverflow.com/questions/11389995/directional-arrow-from-source-to-destination-driving-directions">this</a> post, and everything was working fine. Over the past days, I've tested the result on the emulator and on my phone, and the route path was successfully drawn.</p> <p>However, without modifying literally ANYTHING in code, today I realized that the route path drawing fails and the app crashes. As I am expected to do, I use the following code to "build" the uri link for the KML file generation:</p> <pre><code>public static String getUrl(double fromLat, double fromLon, double toLat, double toLon) {// connect to map web service StringBuffer urlString = new StringBuffer(); urlString.append("http://maps.google.com/maps?f=d&amp;hl=en"); urlString.append("&amp;saddr=");// from urlString.append(Double.toString(fromLat)); urlString.append(","); urlString.append(Double.toString(fromLon)); urlString.append("&amp;daddr=");// to urlString.append(Double.toString(toLat)); urlString.append(","); urlString.append(Double.toString(toLon)); urlString.append("&amp;ie=UTF8&amp;0&amp;om=0&amp;output=kml"); return urlString.toString(); } </code></pre> <p>This function returns a Uri like "<strong><a href="http://maps.google.com/maps?f=d&amp;hl=en&amp;saddr=35.5133804,24.0421933&amp;daddr=35.511732,23.974715&amp;ie=UTF8&amp;0&amp;om=0&amp;output=kml" rel="nofollow noreferrer">http://maps.google.com/maps?f=d&amp;hl=en&amp;saddr=35.5133804,24.0421933&amp;daddr=35.511732,23.974715&amp;ie=UTF8&amp;0&amp;om=0&amp;output=kml</a></strong>" for the kml file. However, after experimenting I realized that now with the exact same KML link as above, the SAX parser tries to parse <strong>the entire Google maps web page source code</strong>! When my app was working, I was downloading the generated kml file and parsed it successfully locally, which was of this form:</p> <pre><code>?xml version="1.0" encoding="UTF-8"?&gt; &lt;kml xmlns="http://earth.google.com/kml/2.0"&gt; &lt;Document&gt; ... &lt;/Document&gt; &lt;/kml&gt; </code></pre> <p>In contrast, now the downloaded file is the entire Google maps web page, which has the following form:</p> <pre><code>&lt;!DOCTYPE html&gt;&lt;html xmlns:v="urn:schemas-microsoft-com:vml"&gt; &lt;head&gt; &lt;meta content="text/html;charset=ISO-8859-1" http-equiv="content-type"/&gt; &lt;meta content="Find local businesses, view maps and get driving directions in Google Maps" name="description"/&gt; &lt;link href="//maps.gstatic.com/favicon.ico" rel="shortcut icon"/&gt; &lt;noscript&gt; &lt;meta content="0; URL=/m/directions?dirflg=&amp;amp;saddr=35.5133804,24.0421933&amp;amp;daddr=35.511732,23.974715&amp; amp;hl=en&amp;amp;oi=nojs" http-equiv="refresh"/&gt; &lt;/noscript&gt; &lt;title&gt; ... tick('ua');var id = 'none';if (event.target){id = closestParentId(event.target);}else if (event.srcElement){ id = closestParentId(event.srcElement);} var firstUserAction = event.type + '-' + id; </code></pre> <p>Of course this is the literal Google maps web page source that shows the route path when I view the page from my PC. So my question is if anyone experienced the same VERY weird problem that started happening just like this. </p> <p>Thank you!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload