Forum

Thread tagged as: Question, Error

Google map 404 error

I have implemented Google map and getting 404 error.

Error Message

https://maps.google.com/maps/api/staticmap/xxx?key=MYAPIKEY&center=9.919744403322333,124.12514946757813&size=100%x500&scale=2&zoom=13&maptype=map&markers=color:red|color:red|9.9251554,124.0743377 404 ()

I have Geocoding API , Static Maps API & Maps Javascript API enabled.

Latest Runway version installed. 3.1.1

Am I missing something?

Edward Johansen

Edward Johansen 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the 404 from Google?

Yes, the URL is coming from one of perch file. PerchFieldTypes.class.php

Drew McLellan

Drew McLellan 2638 points
Perch Support

What is the URL that the 404 is for?

I watch this and implemented it on my website, https://docs.grabaperch.com/video/v/google-maps/

Now I'm getting that 404 error.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, fine, but what is the URL issuing the 404?

Yes, this is the part of perch file that code is coming from

PerchFieldTypes.class.php


if (PERCH_RWD) { $width = ($tag->width() ? $tag->width() : ''); $height = ($tag->height() ? $tag->height() : ''); }else{ $width = ($tag->width() ? $tag->width() : '460'); $height = ($tag->height() ? $tag->height() : '320'); } $static_width = ($width == '' ? '460' : $width); $static_height = ($height == '' ? '320' : $height); $out['zoom'] = $zoom; $out['type'] = $type; $r = '<img id="cmsmap'.PerchUtil::html($id).'" src="//maps.google.com/maps/api/staticmap'; $r .= '?key='.PerchUtil::html($this->_get_api_key(), true).'&center='.$clat.','.$clng.'&size='.$static_width.'x'.$static_height.'&scale=2&zoom='.$zoom.'&maptype='.$type; if ($lat && $lng) $r .= '&markers=color:red|color:red|'.$lat.','.$lng; $r .= '" '; if ($tag->class()) $r .= ' class="'.PerchUtil::html($tag->class()).'"'; $r .= ' width="'.$static_width.'" height="'.$static_height.'" alt="'.PerchUtil::html($adr).'">'; $out['admin_html'] = $r; $map_js_path = PerchUtil::html(PERCH_LOGINPATH, true).'/core/assets/js/public_maps.min.js'; if (defined('PERCH_MAP_JS') && PERCH_MAP_JS) { $map_js_path = PerchUtil::html(PERCH_MAP_JS, true); }
Drew McLellan

Drew McLellan 2638 points
Perch Support

Please show me the 404 error, including the URL that is missing.

Solved the problem. Google map is not allowing 100% width in content template. I had to use the "define('PERCH_RWD', true);" and no height and width.