Loading...
Logo
Processing Forum
Anybody done this before?  I keep getting a REQUEST_DENIED when I run this, but I checked the geocoding documentation, and it says that a key is not required...any ideas?




void setup(){
size(600, 600);
}


void draw(){
  background(0);
  
  String url =  "http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true_or_false";


  XMLElement xmlFeed = new XMLElement(this, url);
  int numEntries = xmlFeed.getChildCount();


  for (int i=0; i<numEntries; i++) {

    XMLElement entry = xmlFeed.getChild(i);
    XMLElement[] kids = entry.getChildren();


println(xmlFeed);
  
}
}

Replies(1)

The Google example you've worked from is confusing.  The sensor value needs to be "true" OR "false" so either of these work:
Copy code
  1. String url =  "http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true";
Copy code
  1. String url =  "http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false";

You should move all the querying code to a separate function and call it from setup().  Calling an internet API at draw rate isn't good practice.