Mamun Paul Posted May 29, 2020 Share Posted May 29, 2020 On 5/14/2020 at 12:50 PM, Mamun Paul said: The site I'm working on was already upgraded to 2.8. Is the Map maker only compatible for the processwire 3.0.148? I've upgraded Processwire from 2.8 to 3.0.0.148 and also upgraded map marker module to 2.0.9 Still on the admin sub location maps are not visible on page load on chrome. Need to double click then it appears. While on Mozilla it works fine. Why this is happening? Link to comment Share on other sites More sharing options...
Mamun Paul Posted June 1, 2020 Share Posted June 1, 2020 After upgrade to Processwire 3.0.148 there is an issue with map markers.The map sometimes appears all in grey and one has to click on the location pin to have the map appear. The + and - zoom buttons are also missing and appear only when clicking full screen. Link to comment Share on other sites More sharing options...
Mamun Paul Posted June 3, 2020 Share Posted June 3, 2020 m I the only person who is facing this issue? I'm unable to debug the issue. Please help.... Link to comment Share on other sites More sharing options...
Mats Posted June 3, 2020 Share Posted June 3, 2020 @Mamun Paul Do you have any console errors? OT: Looks like this site could be of interest based on your map: https://alltpaoland.se/platser/parboang-naturturism/ ? Link to comment Share on other sites More sharing options...
Mamun Paul Posted June 5, 2020 Share Posted June 5, 2020 Thanks for the reply @Mats I didn't find any console error. As I've looked for the Map marker module it is compatible upto Processwire 2.7. Is there any other module or plugin which have same functionality as Map Marker? Link to comment Share on other sites More sharing options...
Mats Posted June 5, 2020 Share Posted June 5, 2020 Do you have the latest version of the Googles map marker module? There was an issue with hidden elements (looks like the map is in a repeater field) although it should be fixed in the latest version: https://github.com/ryancramerdesign/FieldtypeMapMarker/pull/2 There is a Leaflet version of this module: https://modules.processwire.com/modules/fieldtype-leaflet-map-marker/. Don't know if it will solve your issue though. Link to comment Share on other sites More sharing options...
Mamun Paul Posted June 11, 2020 Share Posted June 11, 2020 On 6/5/2020 at 11:23 PM, Mats said: Do you have the latest version of the Googles map marker module? There was an issue with hidden elements (looks like the map is in a repeater field) although it should be fixed in the latest version: https://github.com/ryancramerdesign/FieldtypeMapMarker/pull/2 There is a Leaflet version of this module: https://modules.processwire.com/modules/fieldtype-leaflet-map-marker/. Don't know if it will solve your issue though. Hello @Mats I've installed https://modules.processwire.com/modules/fieldtype-leaflet-map-marker/. I'm still facing the same issue of sub location map not visible. This issue is only in chrome on double click the map appers while in mozila it works fine. Do you know why it is happening? Thanks in advance! Link to comment Share on other sites More sharing options...
Mats Posted June 11, 2020 Share Posted June 11, 2020 (edited) No, i don't know why it is happening. Check the link for the pull request, it might help. This could help also: https://stackoverflow.com/questions/48599370/issues-with-google-map-greyed-out Edited June 11, 2020 by Mats Added SO link. Link to comment Share on other sites More sharing options...
sjaaksken Posted August 21, 2020 Share Posted August 21, 2020 not sure if it is mentioned somewhere but how do I add a map with a location to a blogpost? I'm a bit lost with all the code. Link to comment Share on other sites More sharing options...
hollyvalero Posted September 30, 2020 Share Posted September 30, 2020 Hi! I'm experimenting with Ryan's RCDmap.js... got it all working but just wanted to use SVG images for the map markers. There's no class I can get... and #map .svg doesn't work. It seems like there should be a way in defining the icons to add something similar to iconSize: [30,30] or google's map options: size: new google.maps.Size(71, 71), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(17, 34), scaledSize: new google.maps.Size(25, 25) Not having much luck... and yes, I can do very tiny png images but they are tend to get blurry on higher res devices. Not sure whether I should just try leaflet maps instead. /* The path to the icons folder */ var path = '/site/templates/icons/'; var marker = new google.maps.Marker({ position: latLng, map: RCDMap.map, icon: path + cat + '.svg' }); Link to comment Share on other sites More sharing options...
TheMick Posted March 15, 2021 Share Posted March 15, 2021 Google allows to restrict API keys, but you can only restrict to URLs (useful for showing maps) or IP-addresses (useful for geocoding with PHP). I tested the inputfield using API keys with one of the restrictions each and one with no restrictions. The (expected) result: key restricted only to URL: Map in the inputfield works, geocoding with hitting enter (not clicking outside the field before) works key restricted to IP: Map does not work, but server-side geocoding (with PHP on save) works key with no restrictions (not recommended!): everything works So I think, there should be two fields for the configuration in the module: one for a server-side key and one for a frontend key (also used fro the inputfiled map). Or do I get something wrong? Something else I noticed: In InputfieldMapMarker.module on line 79 and in MarkupGoogleMap.module on line 161 I think the domain should be googleapis.com instead of google.com 1 Link to comment Share on other sites More sharing options...
JayGee Posted August 19, 2021 Share Posted August 19, 2021 On 3/15/2021 at 2:12 PM, TheMick said: Google allows to restrict API keys, but you can only restrict to URLs (useful for showing maps) or IP-addresses (useful for geocoding with PHP). I tested the inputfield using API keys with one of the restrictions each and one with no restrictions. The (expected) result: key restricted only to URL: Map in the inputfield works, geocoding with hitting enter (not clicking outside the field before) works key restricted to IP: Map does not work, but server-side geocoding (with PHP on save) works key with no restrictions (not recommended!): everything works So I think, there should be two fields for the configuration in the module: one for a server-side key and one for a frontend key (also used fro the inputfiled map). Or do I get something wrong? Something else I noticed: In InputfieldMapMarker.module on line 79 and in MarkupGoogleMap.module on line 161 I think the domain should be googleapis.com instead of google.com I'm just using this module for the first time in a while and finding similar behaviour (Google Cloud has change a lot since I last used this module). I haven't tested the scenarios as thoroughly as @TheMick however I can confirm that everything works without the API key restriction, however restricting it by IP or Http referrer in GC dashboard generates a 'Error geocoding address' response and the lat/long fields don't populate. Link to comment Share on other sites More sharing options...
JayGee Posted August 19, 2021 Share Posted August 19, 2021 4 hours ago, Guy Incognito said: I'm just using this module for the first time in a while and finding similar behaviour (Google Cloud has change a lot since I last used this module). I haven't tested the scenarios as thoroughly as @TheMick however I can confirm that everything works without the API key restriction, however restricting it by IP or Http referrer in GC dashboard generates a 'Error geocoding address' response and the lat/long fields don't populate. I looked into this further. I tweaked the module to dump out the response from Google API and it confirms that indeed referrer restricted API keys won't work with the Geocode API. Array ( [error_message] => API keys with referer restrictions cannot be used with this API. [results] => Array ( ) [status] => REQUEST_DENIED ) Link to comment Share on other sites More sharing options...
DV-JF Posted August 20, 2021 Share Posted August 20, 2021 20 hours ago, Guy Incognito said: I looked into this further. I tweaked the module to dump out the response from Google API and it confirms that indeed referrer restricted API keys won't work with the Geocode API. Array ( [error_message] => API keys with referer restrictions cannot be used with this API. [results] => Array ( ) [status] => REQUEST_DENIED ) Hey @Guy Incognito, hey all I've struggled with the same error message, but found a solution: Make sure that you've enabled both API's the "Maps JavaScript API" & the "Geocoding API" . Also make sure to add the wildcards in the restriction settings like so: https://example.com/* https://www.example.com/* http://example.com/* http://www.example.com/* Hope this'll help a little bit. Greets! Link to comment Share on other sites More sharing options...
JayGee Posted August 20, 2021 Share Posted August 20, 2021 35 minutes ago, DV-JF said: Hey @Guy Incognito, hey all I've struggled with the same error message, but found a solution: Make sure that you've enabled both API's the "Maps JavaScript API" & the "Geocoding API" . Also make sure to add the wildcards in the restriction settings like so: https://example.com/* https://www.example.com/* http://example.com/* http://www.example.com/* Hope this'll help a little bit. Greets! Hi @DV-JF - I'm pretty sure I do have both these enabled but I will check thanks. I have found that IP restriction works fine for my requirements though after all - turns out that my server was reporting an IPv6 IP and not the IPv4 I had set in the restrictions. ? So back up and running for now ? Link to comment Share on other sites More sharing options...
HMCB Posted October 29, 2021 Share Posted October 29, 2021 Is there any way to prevent this module from deleting the address entered in the field after the page has been saved? I love that the latitude and longitude is created and saved on page reload, but it would be nice to have a reference of what those coordinates are for by keeping the contents of the address field. Link to comment Share on other sites More sharing options...
HMCB Posted October 29, 2021 Share Posted October 29, 2021 10 minutes ago, HMCB said: Is there any way to prevent this module from deleting the address entered in the field after the page has been saved? Never mind. After I entered a different address than the one entered in the field set-up, things are working just fine. Link to comment Share on other sites More sharing options...
Fuzen Posted March 1, 2022 Share Posted March 1, 2022 (edited) I would like to iterate through PW pages and grab the coordinates (that FieldtypeMapMarker created on saving the page) and display those multiple markers in __one__ map. I would love to have a module that does that, but I don’t see that in the PW module directory. Has anyone done anything like this in a PW project? I did a little research and found this from Google: https://googlemaps.github.io/js-markerclusterer/ It appears to ingest a JSON file for the marker locations. Edited March 1, 2022 by kongondo moderator note: Merged your thread to FieldtypeMapMarker's support thread. Link to comment Share on other sites More sharing options...
Fuzen Posted March 1, 2022 Share Posted March 1, 2022 Well, looks like it may be simpler than I thought. This has a PHP example: https://phppot.com/php/add-markers-to-show-locations-on-google-maps/ This tutorial has a nice Fiddle code example: https://gis.stackexchange.com/questions/300121/multiple-markers-on-google-maps-using-javascript-php-and-sql Link to comment Share on other sites More sharing options...
wbmnfktr Posted March 2, 2022 Share Posted March 2, 2022 As those mapmarker details are saved within those fields for any page, you could just query them. echo $page->yourMapMarkerField->address; // outputs the address you entered echo $page->yourMapMarkerField->lat; // outputs the latitude echo $page->yourMapMarkerField->lng; // outputs the longitude echo $page->yourMapMarkerField->zoom; // outputs the zoom level https://processwire.com/modules/fieldtype-map-marker/ And from there you could pass it on to your template to build a custom map. <?php namespace ProcessWire; $mapitems = $pages->find("template=yourTemplateWithMapMarkers"); $options = array( 'markerIcon' => 'fa-icon', // your custom icon 'markerColour' => 'color', // your custom color 'height' => '100%', 'zoom' => '12', 'scrollWheelZoom' => 'false', 'useStyles' => 'false', 'popupFormatter' => function ($page) { $lines = array(); $lines[] = "$page->street"; $lines[] = "$page->postalcode $page->city"; return implode("<br />", $lines); } ); ?> That's what I use with the LeafletMapMarker Module (a fork of Map Marker for Google) Which then results in this (see bottom of that page):https://www.restaurants-neumuenster.de/restaurants/ 1 Link to comment Share on other sites More sharing options...
adrian Posted March 2, 2022 Share Posted March 2, 2022 Depending on how many locations you have findRaw() might be a useful alternative to find() 2 Link to comment Share on other sites More sharing options...
Fuzen Posted March 3, 2022 Share Posted March 3, 2022 On 3/2/2022 at 6:49 PM, wbmnfktr said: That's what I use with the LeafletMapMarker Module (a fork of Map Marker for Google) Which then results in this (see bottom of that page):https://www.restaurants-neumuenster.de/restaurants/ That map is very nice. I’ll keep Leaflet in mind for my next improvement to my app. Thank you, as I see how some of that code you posted would be beneficial. Turns out MapMarker can’t be used in FormBuilder, which I didn’t realize. I wanted to use it for capturing coordinates as entries were saved. So instead, I ended up using a PHP script that I tailored to my needs. In PW, I queried and saved all the addresses (right now about 10–12, eventually up to 30) to an array. I then passed that array to Google’s GeoCoder API and let it do the hard work (parsing the address) instead of me having to figure out latitude and longitude. It works well and loads fast. I’m not a developer but thanks to helpful answers by everyone in this community, I’m able to learn as I go. 1 Link to comment Share on other sites More sharing options...
cst989 Posted May 6, 2022 Share Posted May 6, 2022 For some reason this map marker field has stopped working on my production server. It just saves 0.00000 as both lat and lng values, even though it correctly finds and shows the lat/lng on the field itself. Link to comment Share on other sites More sharing options...
rst Posted March 29, 2023 Share Posted March 29, 2023 Looks like theres an issue with this module and PHP 8+ Fatal Error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in site/modules/FieldtypeMapMarker/InputfieldMapMarker.module:208 1 Link to comment Share on other sites More sharing options...
Andy Posted October 16, 2023 Share Posted October 16, 2023 Hi @rst On 3/29/2023 at 6:23 PM, rst said: Looks like theres an issue with this module and PHP 8+ Fatal Error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in site/modules/FieldtypeMapMarker/InputfieldMapMarker.module:208 For some reason in PHP8+, the coordinate values default to the empty string. You can fix the module code and hard-code their values to float. Until @ryan fixes it. if( ((string) round($lat, $precision)) != ((string) round((float)$this->defaultLat, $precision)) || ((string) round($lng, $precision)) != ((string) round((float)$this->defaultLng, $precision))) { I've requested changes to the https://github.com/ryancramerdesign/FieldtypeMapMarker 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now