uliverse Posted October 14, 2019 Share Posted October 14, 2019 I have encountered a bug: as soon as I turn on the cache function (Processwire built-in) the maps don't load any more on Chrome. Firefox works, though. Any idea what causes this? Link to comment Share on other sites More sharing options...
sujag Posted October 16, 2019 Share Posted October 16, 2019 On 10/6/2019 at 6:07 PM, sujag said: I'm trying to automatically add pages containing a field with this fieldtype. while all other fields are populated as expected the lat/lng part of my geolocation field keeps its default values. Is there a special syntax to address these I don't really understand why, but it works, if I change lat lng values in a second step. $newPoi = $pages->add("tmbPoi", "$parentPage->url", [ 'name' => $thisPoiId, 'title' => $poi['name'], ... ] $newPoi->geolocation->lat = $lat; $newPoi->geolocation->lng = $lng; $newPoi->of(false); $newPoi->save('geolocation'); Link to comment Share on other sites More sharing options...
Leftfield Posted November 3, 2019 Share Posted November 3, 2019 Hi @All, When I turn on cache, the map is blank. What variable should I exclude or...!? Link to comment Share on other sites More sharing options...
MarkE Posted November 18, 2019 Share Posted November 18, 2019 This is a really nice module, but why is the fully working version only in the 'dev' release? EDIT: Having said that, I now find I have the same problem as the previous poster. It all works fine on my Dev machine. But in the live environment it is blank. EDIT 2: In my case, the problem was simple - just forgot to upload the additional lines in the <head> - i.e. <?php $map = wire('modules')->get('MarkupLeafletMap'); ?> <?php echo $map->getLeafletMapHeaderLines(); ?> Is that your problem @Leftfield? 1 Link to comment Share on other sites More sharing options...
Leftfield Posted November 23, 2019 Share Posted November 23, 2019 @MarkE thank you for your answer but it doesn't help since I load files manually (except main js). Anyway, I will remove module for two reasons (both not fault of the module): First: Lon and Lat are not compatible with Google Maps for my country. There is some wild offset. Second: Will test for SEO, doubt is that Google doesn't rank website with Open street map. Link to comment Share on other sites More sharing options...
ank Posted November 24, 2019 Share Posted November 24, 2019 i installed the module, but i'm not able to get it working, i get the error "Error geocoding address" in the backend and a blank map ? What is missing/wrong ? Link to comment Share on other sites More sharing options...
DL7 Posted November 27, 2019 Share Posted November 27, 2019 On 11/24/2019 at 6:40 PM, ank said: i installed the module, but i'm not able to get it working, i get the error "Error geocoding address" in the backend and a blank map ? What is missing/wrong ? I have the same issue. Installed it as per the guidelines, but it throwing me the same issue. Link to comment Share on other sites More sharing options...
ank Posted November 27, 2019 Share Posted November 27, 2019 i added the coordinates manually and now i get the map but Is it possible to change the colors of the map Link to comment Share on other sites More sharing options...
DL7 Posted November 28, 2019 Share Posted November 28, 2019 18 hours ago, DL7 said: I have the same issue. Installed it as per the guidelines, but it throwing me the same issue. So using the dev version, the geo coding is working. (also when you add a key to the google geo call). But I now run into an issue where the map is grey out in the "edit page" set-up. I cant fill in an address either as the input field is disabled. @hellomoto mentioned this issue before. Did you got a chance to fix it? @Mats ay pointers? Link to comment Share on other sites More sharing options...
DL7 Posted November 29, 2019 Share Posted November 29, 2019 So, somehow I got it fixed, by changing the Default Map Tile Provider in the field setting. Somehow the default OpenStreetMap.Mapnik doesnt work for me. Link to comment Share on other sites More sharing options...
celfred Posted January 22, 2020 Share Posted January 22, 2020 Hello, After spending hours trying to find a solution, I ask the community for help... I have a map showing up on page load. It works fine but it takes quite a while. You can see it in action there : https://planetalert.tuxfamily.org/world/6ef (be patient, loading is terrible) I have already tried caching parts of my page (the different lists) and it's ok, but I can't manage to cache the map. So I would like to load the 2nd tab (when clicking on the faces icon at the top-left corner) by default to get a fast loading page and have my map loading on an ajax call. But all my tests are complete failures ? Here's my ajax part of code : [...] // Setting $allElements (for markers) and $options there $map = $modules->get('MarkupLeafletMap'); $out .= $map->getLeafletMapHeaderLines(); $out .= $map->render($allElements, 'map', $options); Eventually, I get my map box, but it stays empty ? Any advice, please ? Link to comment Share on other sites More sharing options...
MadeMyDay Posted January 22, 2020 Share Posted January 22, 2020 @celfred: This has nothing to do with the map itself. It takes 15 seconds four your server to generate a response, after that the map and all of its content loads fast. So I assume your process of building the list of markers is somewhat ineffective. Can you show the code with which you generate the $allElements Array? Link to comment Share on other sites More sharing options...
celfred Posted January 22, 2020 Share Posted January 22, 2020 On 1/22/2020 at 4:49 PM, MadeMyDay said: @celfred: This has nothing to do with the map itself. It takes 15 seconds four your server to generate a response, after that the map and all of its content loads fast. So I assume your process of building the list of markers is somewhat ineffective. Can you show the code with which you generate the $allElements Array? @MadeMyDay Thanks for your reply. From your comment, I have tried testing my $allEments function (it takes 0.415s on localhost). You can see the code there : https://framagit.org/celfred/planetAlert/blob/master/site/templates/my-functions.inc (function teamFreeWorld() line 1468) BUT I have also tried this : $out .= $map->render($allElements->eq(0), 'map', $options); And the page now loads a lot faster (I can tell the difference even on localhost) ! So maybe it's because I have 56 (or even 96) markers, with a photo... ? What could I do, then ? I hope you (or anybody else) will have other pieces of advice for me ? My site has improved so much over the years thansk to the help of this community (and I have learned so much - you can tell I'm not a pro dev ? - I'm a teacher and the website is for motivating my middle-school pupils) EDIT : Well, for the moment, I've just removed the images in my map markers tooltips and it loads faster... Link to comment Share on other sites More sharing options...
JoZ3 Posted May 7, 2020 Share Posted May 7, 2020 Hi, I have problems with this module, the module show the map in the admin page but not show the map in the front page, the module work fine in my localhost. This is the online page where it doesn't work: https://educakids.edu.co/contacto/ Link to comment Share on other sites More sharing options...
Mats Posted May 8, 2020 Author Share Posted May 8, 2020 Hi! Did you install the MarkupAddInlineScript module? /Mats Link to comment Share on other sites More sharing options...
JoZ3 Posted May 8, 2020 Share Posted May 8, 2020 51 minutes ago, Mats said: Hi! Did you install the MarkupAddInlineScript module? /Mats Hi @Mats the module is installed, Link to comment Share on other sites More sharing options...
houseofdeadleg Posted August 3, 2020 Share Posted August 3, 2020 I have this module implemented on a website and all works well. It currently outputs popups as per the attached image – the first line is generated by the module/options but I can't seem to override it in any way. The map pull sin information from it's child pages, and the title in the pop up links to the child page, but I want to change this so it links to the company's website instead (as per the url further down the pop-up). I've tried changing the 'markerLinkField' / 'markerTitleField' options, leaving them blank, etc but that either displays as per the attached or stops the pop up working. Any thoughts much appreciated. Link to comment Share on other sites More sharing options...
modifiedcontent Posted August 16, 2020 Share Posted August 16, 2020 Issue 1: Why do I get lots of random Russian (?) text when I try to look up addresses? And the location search results are awful; the system suggests random street addresses (with lots of Russian) when you type in something basic like 'London, England'. Full addresses seem to work better, but only without postal codes - 'nothing found' when you try to search with postal codes included. Issue 2: Maps show up in the admin area, but not on the front-end. I have another version of the same site where they do show up on the front-end without problems, so am a bit puzzled where the problem could be. What are typical causes I could check? Edit: The problem with the map not showing up on the front end (Issue 2) had something to do with this error showing up in Chrome Inspect/DevTools: Uncaught TypeError: $ is not a function at (index):529 Something with jQuery. The error disappeared when I copied module files from another site where Leaflet Map did work. Not sure where the cause of the error is exactly. Link to comment Share on other sites More sharing options...
webhoes Posted September 11, 2020 Share Posted September 11, 2020 Uncaught TypeError: $ is not a function at (index):529 I have the same issue with a new install. In dev tools everything is rendered, just no map at all. Link to comment Share on other sites More sharing options...
Beluga Posted September 11, 2020 Share Posted September 11, 2020 2 hours ago, webhoes said: Uncaught TypeError: $ is not a function at (index):529 I have the same issue with a new install. In dev tools everything is rendered, just no map at all. Check that you are loading jQuery in the frontend. 1 Link to comment Share on other sites More sharing options...
webhoes Posted September 11, 2020 Share Posted September 11, 2020 4 minutes ago, Beluga said: Check that you are loading jQuery in the frontend. Your right. I did not notice it was not loaded. Thanks @Beluga Link to comment Share on other sites More sharing options...
webhoes Posted September 18, 2020 Share Posted September 18, 2020 Hello, is it possible to render the input field on a frontend template (for loggedin users only). I tried this: <?php $m = $modules->get('InputfieldLeafletMapMarker'); $m->render(); ?> This generates errors for empty variables. 1× PHP Notice: Trying to get property 'lat' of non-object in ...\InputfieldLeafletMapMarker.module:102 1× PHP Warning: Creating default object from empty value in ...\InputfieldLeafletMapMarker.module:102 1× PHP Notice: Undefined property: stdClass::$lng in ...\InputfieldLeafletMapMarker.module:103 1× PHP Notice: Undefined property: stdClass::$zoom in ...\InputfieldLeafletMapMarker.module:104 1× PHP Notice: Undefined property: stdClass::$address in ...\InputfieldLeafletMapMarker.module:105 1× PHP Notice: Undefined property: stdClass::$status in ...\InputfieldLeafletMapMarker.module:106 2× PHP Notice: Undefined property: stdClass::$status in ...\InputfieldLeafletMapMarker.module:107 1× PHP Notice: Undefined property: stdClass::$raw in ...\InputfieldLeafletMapMarker.module:130 Link to comment Share on other sites More sharing options...
jor Posted October 27, 2020 Share Posted October 27, 2020 Hi there, thanks for providing the Leaflet Map Marker module - very useful! One thing I couldn't figure though is: how can I set NO default address to a field? I need to have the map as an optional field for a given template. Thanks for any advice. jor Link to comment Share on other sites More sharing options...
dab Posted October 29, 2020 Share Posted October 29, 2020 @jor Not sure if this is the correct way, but on my map template I wrap my code with: if($page->marker->address) { } e.g. if($page->marker->address) { $map = wire('modules')->get('MarkupLeafletMap'); $options = array( 'markerFormatter' => function($page, $marker_options) { if ($page->marker_icon->title) { $marker_options['icon'] = $page->marker_icon->title; } if ($page->marker_colour->title) { $marker_options['markerColor'] = $page->marker_colour->title; } // And the icon colour. This is another text field. Colour values like White, Black or an RGB value are ok here. if ($page->marker_icon_colour->title) { $marker_options['iconColor'] = $page->marker_icon_colour->title; } return $marker_options; }, 'popupFormatter' => function($page) { $out[] = "<strong>$page->headline</strong>"; return implode('<br/>', $out); } ); $content.= $map->render($page, 'marker', $options); } If no address is entered, no map is shown. Link to comment Share on other sites More sharing options...
celfred Posted February 10, 2021 Share Posted February 10, 2021 Hey there, I don't know if this might help smeone (and if I did it the right way), but I had an issue as follow : all maps worked on my site except 2 monuments which didn't show any map. I noticed they had a single quote in their name and if I got rid of it the map appeared. I then ended up doing this (in my '$opitions' array) and it worked : 'popupFormatter' => function($page) { $page->title = str_replace('\'', '\\\'', $page->title); // Dirty hack (no map if single quote in title) $out[] = '<strong>'.sprintf(__('In %1$s, in %2$s'), $page->city->title, $page->country->title).'</strong>'; $out[] = "<p class=\"text-center\"><img src=\"{$page->photo->eq(0)->getCrop('thumbnail')->url}\" /></p>"; // ** NB: Use escaped double quotes if HTML attributes needed ** return implode('<br/>', $out); }, Again, it might sound a bit hacky, but it works for me and maybe it can be useful to someone... 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