Support » Plugin: Basic Google Maps Placemarks » [Plugin: Basic Google Maps Placemarks] Errors everywhere a location is required

  • Really wanted to use this plugin, but can’t seem to get it working. Problems happen when:
    – On the plugin settings page , changing the Map Center Address results in “Error” appearing in the latitude & longitude box
    – Adding a new placemark, adding placemark address, pushing “update” and getting this error:
    That address couldn’t be geocoded, please make sure that it’s correct.
    That address couldn’t be geocoded, please make sure that it’s correct.
    (Yes, duplicated)

    The map itself is finally showing up on the site after redoing the theme, which I was pretty excited about, but only the zoom tools appear, “terms of use” link and Google logo in left bottom corner. Everything else is just a grey box.

    It’s essentially the same as this problem: http://wordpress.org/support/topic/plugin-basic-google-maps-placemarks-cant-get-map-center-adress?replies=8

    – I tried all those solution. I deleted the plugin and reinstalled it a few times, recoded my theme, tried every variation of putting an address in – by coordinates, by just the city name, by adding the state abbreviation, full state name, full address, partial address. I used that map link that was in the comments – everything. I also checked for those server problems. It wasn’t any of those.

    I’d prefer to not put the site url in the forums, but I’d be happy to give privately.

    Any help would be appreciated.

    http://wordpress.org/extend/plugins/basic-google-maps-placemarks/

Viewing 15 replies - 1 through 15 (of 18 total)
  • I got the map to show up by forcing it in the settings.php here:
    $this->mapLatitude = 38.0; //get_option( self::PREFIX . ‘map-latitude’ );
    $this->mapLongitude = -97.0; //get_option( self::PREFIX . ‘map-longitude’ );
    (to show the whole US) on default. This is a project that isn’t really for any long term use, just for the holidays, so hopefully that will suffice for now.

    But still can’t get anything to work when trying to add a placemark. Same error saying “That address couldn’t be geocoded, please make sure that it’s correct.” I’m looking at other options for this purpose, and it all spells me staying late at work on a friday. I really, really just want to use this plugin for the ease of use and be done with this in time to have a strong glass of eggnog.

    So…that’s where I’m at. Down to one problem. Woo.

    Plugin Author Ian Dunn

    (@iandunn)

    Hey, I’m sorry to hear that you’re having a hard time with the plugin.

    For the visual problems in your theme, it’s probably just some CSS from your theme conflicting with the map styles. Send me the URL to the map and I’ll take a look. You can use the contact form on my website to do that privately.

    For the placemark geocoding problem, the plugin uses WordPress’ wp_remote_get() function to get the coordinates from Google Maps’ web service, which is a pretty simple task from the plugin’s perspective, so I’d guess that there’s a problem with your server that’s preventing the communication. Can you add this to your theme’s functions.php file, then login to the WordPress admin panel and let me know the results?

    function bgmp_remote_get_test()
    {
    	$response = wp_remote_get( 'http://api.twitter.com/1/users/show.json?screen_name=iandunn' );
    
    	if( is_wp_error( $response ) )
    		wp_die( 'Test failed. Details:<pre>'. implode( 'Geocode error: ', $response->get_error_messages() ) . '</pre>' );
    	else
    	{
    		$value = json_decode( $response['body'], true );
    		wp_die( 'Test succeeded. You should see the name of a city here: '. $value[ 'location' ] );
    	}
    }
    add_action( 'admin_head', 'bgmp_remote_get_test' );

    Also, you can try switching to the Twenty Eleven theme and disabling all other plugins, to make sure that it’s not a conflict with something else.

    Plugin Author Ian Dunn

    (@iandunn)

    If that test fails, try installing the Core Control plugin and going to the External HTTP Access screen; from there, click the ‘Test Transport’ link for each of them. If any of the transports fails the test, disable it.

    Then try saving a placemark again and seeing if you still get the error. If you do, tell me which transports you have enabled and which are disabled.

    Thanks again for the help. The results of the test were:
    Test succeeded. You should see the name of a city here: Seattle

    Also, the site is brand new, I just made it from scratch. The only plugin I’m using is Akismet.
    I think I tried to do the test with the Twenty Eleven theme a few hours ago, but, the genius that I am – I forgot to bring the ftp credentials home with me, so I can’t access the functions.php anymore to change it from the test message. I changed it from the wordpress editor. Starting in on that eggnog.

    Plugin Author Ian Dunn

    (@iandunn)

    Hmmm, that’s really odd. If you can edit core.php in the plugin’s directory, try replacing the current geocode() function with with this one:

    public function geocode( $address )
    {
    	$geocodeResponse = wp_remote_get( 'http://maps.googleapis.com/maps/api/geocode/json?address='. str_replace( ' ', '+', $address ) .'&sensor=false' );
    	if( is_wp_error( $geocodeResponse ) )
    	{
    		$this->enqueueMessage( BGMP_NAME . ' geocode error: '. implode( '<br />', $geocodeResponse->get_error_messages() ), 'error' );
    		return false;
    	}
    
    	$coordinates = json_decode( $geocodeResponse['body'] );
    
    	if( empty( $coordinates->results ) )
    		return false;
    	else
    		return array( 'latitude' => $coordinates->results[0]->geometry->location->lat, 'longitude' => $coordinates->results[0]->geometry->location->lng );
    }

    Then try to save a placemark again, and you should get a more detailed error message.

    Okay, just tried to save a new placemark with the different code in the core.php in the plugin, it gave the same error:
    That address couldn’t be geocoded, please make sure that it’s correct.

    That address couldn’t be geocoded, please make sure that it’s correct.

    Now it’s back to being a grey box, map has disappeared.
    Also, this is the second wordpress install on this site. Thought that wouldn’t matter, but maybe it does?

    Plugin Author Ian Dunn

    (@iandunn)

    As long as they’re in separate directories, it shouldn’t matter.

    It’s weird that there wasn’t any additional error info. Try replacing geocode() again with this,

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Then save the map address settings and let me know the output.

    I also released version 1.6 last night, so you might want to upgrade to it before changing the geocode() method.

    Saved the settings at got this:
    Type: array
    Length: 5
    Content:

    Array
    (
    [headers] => Array
    (
    [content-length] => 1207
    [content-type] => text/html
    [date] => Mon, 12 Dec 2011 19:16:17 GMT
    [server] => GFE/2.0
    )

    [body] =>
    Google
    Sorry…
    We’re sorry…
    … but your computer or network may be sending automated queries. To protect our users, we can’t process your request right now.

    See Google Help for more information.

    © 2009 Google – Google Home

    [response] => Array
    (
    [code] => 403
    [message] => Forbidden
    )

    [cookies] => Array
    (
    )

    [filename] =>
    )
    Type: NULL
    Length: 0
    Content:

    NULL

    Also upgraded as soon as I saw the message of the upgrade this morning.

    Plugin Author Ian Dunn

    (@iandunn)

    Ah, ok, it looks like Google is automatically blocking any requests from your server (or netblock) because it detected some behavior that violated it’s terms of use.

    Do you run that server at your office, or is it in a data center? Shared hosting or VPS/dedicated/colo? Most likely another user on that server (or another server within the same netblock) is doing something naughty that caused Google to block any traffic coming from it.

    If it’s shared hosting, you could contact your ISP and ask them to look into it. After they remove the problem then it might start working again after a delay (probably 1-7 days), or they may need to contact Google to ask that the server be removed from the blacklist.

    Hello,

    I seem to have the same problem.

    When I try to set the Map Center Address, I get the following error:

    Basic Google Maps Placemarks geocode error: name lookup timed out

    I used scribblessd’s workaround to fix this, and it worked. Not ideally of course, but it works.

    I also tried to add a placemark. Though, when I try to “save” my placemark using an excisting address, I get the following error:

    Basic Google Maps Placemarks geocode error: name lookup timed out
    
    That address couldn't be geocoded, please make sure that it's correct.
    
    Basic Google Maps Placemarks geocode error: name lookup timed out
    
    That address couldn't be geocoded, please make sure that it's correct.

    I guess it errors twice because of the latitude and longitude?

    Anyways, seems to be the same error..

    Do you know of any way to fix this?

    Plugin Author Ian Dunn

    (@iandunn)

    Hi mikereinten, it sounds like your server can’t connect to Google. Have you tried any other Google Maps plugins? Did they work? I would guess that they didn’t either.

    To get more details on the problem, edit core.php in the plugin folder and change line 523 from:

    $geocodeResponse = wp_remote_get( 'http://maps.googleapis.com/maps/api/geocode/json?address='. str_replace( ' ', '+', $address ) .'&sensor=false' );

    to:

    $geocodeResponse = wp_remote_get( 'http://maps.googleapis.com/maps/api/geocode/json?address='. str_replace( ' ', '+', $address ) .'&sensor=false' );
    $this->describe( $geocodeResponse );

    Then copy/paste the results here and I’ll take a look.

    Type: object
    Length: 1
    Content:
    
        WP_Error Object
        (
            [errors] => Array
                (
                    [http_request_failed] => Array
                        (
                            [0] => name lookup timed out
                        )
    
                )
    
            [error_data] => Array
                (
                )
    
        )

    That’s what I get. As far as I can guess, somehow I cannot make a http request to Google?

    I do get a map on my website (centered somewhere in the middle of nowhere) and when I use [bgmp-list], I get a nice list with placemarks and corresponding url’s.

    edit: I will try to add a placemark again when I am at home and see if that makes any difference..

    I was able to get a different Google map plugin to work: Google Map Shortcode. I investigated foul play on our servers…it’s always possible, we have a lot of different sites. But don’t think that’s the case at the moment.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: Basic Google Maps Placemarks] Errors everywhere a location is required’ is closed to new replies.