[Google Maps API v3] How to handle direction status other than OK?

2011-03-16 Thread Karthick
Hi All,
I am trying get direction between two cities using google maps Javascript
API.  If i try the following two cities, it is not giving anything.
*Two cities : london and  Chicago, Cook, Illinois*
I suspect this is because of the direction status value. Initially i used
only OK status value. Then i added all the direction status value in the
code.
still i didn't get anything.
Anyone please tell me how to handle those direction status value?
*
NOTE:*
I tried the same two cities in the maps.google.com. It was giving like "No
route found". I want to get the output like that. how do i get that?
*
My code:*
 function calcRoute() {
//var start = document.getElementById("start").value;
//var end = document.getElementById("end").value;
var start = "*london*";
var end = "*Chicago, Cook, Illinois*";
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
  if (status == google.maps.DirectionsStatus.OK) {
alert("1");
directionsDisplay.setDirections(response);
  }
  if(status == google.maps.DirectionsStatus.INVALID_REQUEST){
  alert("2");
   }
   if(status == google.maps.DirectionsStatus.MAX_WAYPOINTS_EXCEEDED){
   alert("3");
}
if(status == google.maps.DirectionsStatus.NOT_FOUND){
alert("4");
 }
 if(status == google.maps.DirectionsStatus.OVER-QUERY_LIMIT){
 alert("5");
 }
 if(status == google.maps.DirectionsStatus.REQUEST_DENIED){
 alert("6");
 }
 if(status == google.maps.DirectionsStatus.UNKNOWN_ERROR){
 alert("7");
  }
 if(status == google.maps.DirectionsStatus.ZERO_RESULTS){
 alert("8");
     }
});
  }
*
output:
**No alert is coming.

If i try germany and london, it is giving alert  as "1".
*--
*Regards,*
*Karthick
*

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.



Re: [Google Maps API v3] Re: Reference Error: google is not defined

2011-03-04 Thread Karthick
@Rossko: does it mean it is loaded in webpage only?
  is it possible to load maps javascript API on non web
browser environment?


On Thu, Mar 3, 2011 at 3:35 PM, Rossko  wrote:

> > I am trying to execute javascript through Qt script.
>
> For questions about how to use Qt, try here
> http://www.qtcentre.org/forum.php
>
> The maps javascript is normally loaded with 

[Google Maps API v3] how to include header file in javascript?

2011-03-03 Thread Karthick
Hi All,
How to inlclude header file (like #include in c ) in javascript?
If anyone knows, please tell me.

I tried using import. but it gives an error "import is not defined"

Note:
I am not using browser for executing javascript.
Please Keep that in mind.

Thanking You

-- 
*Regards,*
*Karthick
*

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.



[Google Maps API v3] How to import?

2011-03-03 Thread Karthick
Hi All,
How to import following url in javascript?
Url:
http://maps.google.com/maps/api/js?sensor=false

The above url contains all the symbols and definition of Google Maps API V3.
This Url needs to be included before calling Google maps API.
If anyone knows, please help me to resolve this issue?
-- 
*Regards,*
*Karthick
*

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.



[Google Maps API v3] Reference Error: google is not defined

2011-03-03 Thread karthick
Hi All,
I am trying to execute javascript through Qt script.
My javascript contains code for google maps API.
when i ran it through Qt script, it gives an Error like "Reference
Error: google is not defined".

I think the problem is the
http://maps.google.com/maps/api/js?
sensor=false">

line from the html file. If I use the <> brackets, the java script
engine won't compile it, and if I omit the line, the program gets the
"google not found" error...

Please anyone help me how to call URL inside script tag in javascript
which is been executed by Qt script?

NOTE:
Here, I have included JS and Qt script file.
JS file:
function calcRoute() {
  var directionsService = new google.maps.DirectionsService(); //
getting error here."google not defined"
  var start = "chennai";
  var end = "bangalore";
  var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
  };
  directionsService.route(request, function(resp, status) {
if (status == google.maps.DirectionsStatus.OK) {
return resp;
}

  });
}

QtScript file:
#include 
#include 
#include 

int main(int argc, char **argv)
{
   QApplication app(argc, argv);
   QScriptEngine engine;
   QScriptValue global = engine.globalObject();

   QString fileName1 = "direction.js";
   QFile scriptFile1(fileName1);
   if(!scriptFile1.open(QIODevice::ReadOnly))
   {
  qDebug() << "error";
   }
   QTextStream stream1(&scriptFile1);
   QString contents1 = stream1.readAll();
   scriptFile1.close();
   QScriptValue result1 = engine.evaluate(contents1, fileName1);
   if(engine.hasUncaughtException()) {
   int line = engine.uncaughtExceptionLineNumber();
   qDebug() << "uncaught exception at line" << line << ":" <<
result1.toString();
   }
   QScriptValue val1 = global.property("calcRoute");
   QScriptValueList args1;
   QScriptValue final_res1 = val1.call(QScriptValue(), args1);  //
calling JS function calcRoute with no args
   qDebug() << "The result is: " << final_res1.toString();
   return app.exec();
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.



[Google Maps API v3] Error while executing Javascript through Qt

2011-03-01 Thread karthick
Hi All,
I am trying to execute Java script code through Qt Script. While running 
that code, I was getting error like "Reference Error: can't find variable 
Google". my Java script contains code for calculating  direction.  

While executing JS through HTML, JS code is included in  tag.
I don't know how to include the following javascript in Qt.