How can I use Google Maps with Processing? - google-maps

I want to use Google Maps API with Processing. Until now I was just able to get Google Places data, but I'm struggling with the map itself. I know about other map options, like unfold or modestMaps, but I need Google. In particular because of the directions API in further progress. I've searched this forum and the web, without any help. I thought it should be quite
easy.
How can I use Google Maps with Processing?

I'm not sure about getting a full featured, dynamic Google Maps within your Processing app, but you might be able to modify the Processing library for the Google Weather API to instead use the Directions or Static Maps APIs. http://www.onformative.com/lab/google-weather-library-for-processing/
If you download the source and check out GoogleWeather.java you can see the constructor is calling the WeatherAPI and getting back the XML result. I think you could do the same thing except use the Directions API in it's place.
Here's a post on a Java blog about showing Static Maps API results in Java, which might be translatable into Processing: http://weblogs.java.net/blog/cajo/archive/2010/10/16/adding-google-maps-your-java-application
For something more dynamic, you might be able to adapt JXMapViewer, check out this article: http://today.java.net/pub/a/today/2007/10/30/building-maps-into-swing-app-with-jxmapviewer.html

Related

How do I access data from Google My Maps in my application?

Disclaimer: I am just getting started with Google (My) Maps and I feel like I must really be missing something fundamental.
I have a map built with Google My Maps that I would like to work on using the JavaScript API. Amongst other things, I was looking at the examples from github, but I did not manage find a "decent" way.
Is it possible to directly read/write from/to My Maps, or is the KML export the only option to work on My Maps data using a custom application?

how to access the google map API dynamically in j2me

I have to include the google map API in j2me application. I want to change the route and change the center position dynamically. I have searched a lot. Now I am using google static map API but it shows the image statically. I want to show the map dynamically.
Using javascript API v3 shall I implement google map API in j2me. But one of forums I have found we can't use javascript API in j2me application. Please Give clear idea about this why we can't implement in j2me.
I haven't taken a deeper look, but I found these two links when searching Google.
http://www.developer.nokia.com/Community/Wiki/Archived:Google_Static_Maps_API_in_Java_ME
http://www.jappit.com/blog/midmaps-google-maps-java-me-library/
Whereas it is technically possible to use a static mapping API to display an map in Java ME, If you want to dynamically update the map, you would be much better off using a library which uses a tile server, caches your map tiles and overlays objects on top of it.
This should result in a much lower data traffic overhead as explained here. Only use a Map Image API if all you need is a single map image.
The dynamic mapping library I would suggest is Nokia's HERE Maps API for Java ME, as you can tell from the name, the API is specifically designed to work with Java ME devices.
The API is currently bundled with the Nokia Asha SDK 1.0, but despite this, it is in reality a separate independent plugin and has been designed to work with the full range of standard Java ME devices.
A similar Stack Overflow question answered here describes how to download it.
As a notice of affiliation, I should mention in passing that I do work for Nokia.

Using C++ with Google Maps API. Only text info required

Is it possible to call Google Maps API using a C++ code to retrieve text info about nearby locations.
I am trying to make a simple application (C++) which gives the information about Nearby places on entering longitude and latitude info. Only data I am looking for is the Name of Nearby place and its distance from mentioned location.
Is it possible?
I think your best option would be to use the Google Places API with the JSON format for request.
I don't know about any library that would perform the thing automatically, but there is a thread on StackOverflow about JSON parsing in C++ . Even it does not provide an answer it as good votes scores.
I guess the web call could be made with something like curl.

'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.

Is it possible to get Google Maps Directions using HTTP requests?

Is it possible to use the Google Maps API router just using HTTP? Something like http://maps.google.com?from=blah?to=blah
And have it return some sort of XML or JSON representing the directions?
If you want Google to allow legal access to driving directions via HTTP you might consider voting for the enhancement request: Issue 235. Theoretically, the more people that vote for an enhancement request, the more attention Google give to it.
However, I strongly suspect that there might be contractual issues with the organisations that supply the data. Organisations like TeleAtlas impose restrictions about how Google can use their data. TeleAtlas probably don't want Google to make it legal for people to use their data to create apps for free that directly compete with their own commercial apps and devices.
There is no documented and approved method to access driving directions via an HTTP API request.
This makes it difficult to get driving directions on the server-side, which I assume is your intention.
Not only it is undocumented and difficult to achieve, but it would also violate the restrictions 10.1 and 10.5 of the Google Maps API Terms and Conditions.
However, if you don't mind the challenge, and you believe that rules are there to be broken, you may want to check these articles:
Calculate driving directions using PHP?
Retrieve driving directions from google maps with server-side HTTP calls and show results with static maps for WAP
Actually yes, and they do it themselves
The REST format is like:
http://maps.google.com/maps/nav?output=js&q=from:%20Montreal%20to:%20Toronto&key=apikey
Where q should have the form: "from: x to: y" (url encoded).
Some of the parameters are similar to the HTTP Geocoding service: http://code.google.com/apis/maps/documentation/geocoding/index.html
Mike
As of May, 2010, directions are available via web services:
http://code.google.com/apis/maps/documentation/directions/
Directions are returned in XML or JSON format:
http://maps.google.com/maps/api/directions/json?origin=Boston,MA&destination=Concord,MA&waypoints=Charlestown,MA|Lexington,MA&sensor=false
http://maps.google.com/maps/api/directions/xml?origin=Boston,MA&destination=Concord,MA&waypoints=Charlestown,MA|Lexington,MA&sensor=false
It's pretty danged easy to use.
Here you can find a list of parameters you can pass to the maps.google.com URL. Maybe you'll be able to get the information you need. I don't know what the returned output contains. At least you are able to define different output types.
I have already used this library with python and it works well, although it's against Google Maps API Terms.
API v3 (made the official version in the last six months), does:
http://code.google.com/apis/maps/documentation/directions/
Also note that most of the competing services (Bing Maps, Yahoo, MapQuest, CloudMade, etc) also support RESTful web services along these lines.
As always with these services, check the Terms & Conditions.
I've never used the API but it is pretty easy to get the structured directions data from a google maps page using JS to access the gmap page's DOM.