On Aug 5, 8:53 pm, Iman <[email protected]> wrote:
> I'm terribly sorry 'bout that.
>
> HTTP.
Are you on a shared host?
>
> The part that matters...
> Mappable = is the record in question allowed to be mapped?
> getCleanAddress() = takes the record and returns a HTML Encoded
> string.
>
> After geoTag() is called, I check the status, if it's good... I save
> update the record in the DB with the Lat/Lon values, and move on to
> the next address (repeat.) Until all my new records are geocoded.
>
> Once the records are geocoded, my "find nearby records" page queries
> the DB for values within a certain Lat / Lon range.
>
> public String geoTag(){
>
> if(mappable)
> {
> String url = 'http://maps.google.com/maps/geo?
> q='+getCleanAddress()
> +'&output=csv&oe=utf8&sensor=false&key='+Label.GeoApiKey;
> Http h = new Http();
>
> HttpRequest req = new HttpRequest();
> req.setEndpoint(url);
> req.setMethod('GET');
> HttpResponse res;
> String answer;
> String[] parts;
>
> try{
> res = h.send(req);
> answer = res.getBody();
> parts = answer.split(',');
>
> if(parts[0] == '200')
> {
> Integer accuracy = Integer.ValueOf(parts[1]);
>
> if(accuracy < 6){
> Status = 'Problem with Address';
> mappable = false;
> }
> else{
> Lat = Double.ValueOf(parts[2]);
> Lon = Double.ValueOf(parts[3]);
> Status = 'Located';
> mappable = true;
> }
> }
> else if(parts[0] == '500' || parts[0]== '601' ){
> Status = 'Try again Later';
> mappable =false;
> }
> else if( parts[0] == '620'){
> Status = 'Google Exhausted';
> mappable = false;
> }
> else if(parts[0] == '602' || parts[0] == '603'){
> Status = 'Problem with Address';
> mappable =false;
> }
> else if(parts[0] == '610'){
> Status = 'Bad Google Key';
> mappable =false;
> }
> else{
> Status = 'Try again Later';
> mappable= false;
> }
> }
>
> catch(Exception e){
> mappable = false;
> Status = 'Try again later';
> }
> }
> return Status;
> }
>
> On Aug 5, 3:05 pm, Rossko <[email protected]> wrote:
>
> > Might we see? You haven't even mentioned if you're using HTTP or
> > javascript based geocoding.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---