Mats

Module: Leaflet Map

Recommended Posts

Backend is another issue. For now I would be happy to remove the scroll in the frontend...

Share this post


Link to post
Share on other sites
On 5/19/2018 at 11:51 AM, patman said:

I just had a quick look, I think there is a bug in the render function at the end:


$this->page->inlineScript = $inlineScript;

 This would replace the page content always with the last map. Unfortunately, I was not quickly able to fix it. In my opinion adding a dot


$this->page->inlineScript .= $inlineScript;

should make it, but it didn't (at least in my quick try).

It seems to work for me!!! 😃🎉🎊

God bless you patman! 🙏
Thank you.

Share this post


Link to post
Share on other sites

I cannot install the module. Seems version 2.8. is left out in the compatible versions?

Thx!

 

edit: Nvmd, Manual Install works. Install via Classname didn't.

Modules • ProcessWire • troltsch.de 2018-06-06 12-09-36.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Still trying to figure out how to stop the zoomWheelScroll behavior... There is a respective Leaflet Github issue, but I don't know how to implement that into the module 😞.

Share this post


Link to post
Share on other sites

Hi

I'm using this great module to display points from a page list. I added a leafletmap field on page template and all is good. That's work !

But now, how can I remove geolocalized informations on some pages ?

For example: on a page I set a location to Paris in leafletmap field on the "france" page. Now I would like to delete this geographic information (lat, lng, address, zoom) to remove this point (location to Paris)... How can I do ? When a point is set, it seems to be impossible to delete it... Is there a solution ?

Thks in advance 

Share this post


Link to post
Share on other sites

In my map I want to turn the clustering off. What's the simplest way?

 

Share this post


Link to post
Share on other sites

Hello

Please can you explain how delete a geographic point ? 

I saw in javascript that if Lat is 0 no marker. But how can I set Lat 0 in the InputField ?

Thanks in advance

Share this post


Link to post
Share on other sites

I changed my site to https using the Let's encrypt certificate.

Therefore I uncommented the respective lines in the .htaccess.

But the leafletmap module doesn't seem to get this right and includes the css files in the head of the page with http only. So the page doesn't load because of mixed content.

Where can I fix this so as the https files become included?

Thanks for help.

Share this post


Link to post
Share on other sites
57 minutes ago, joe_ma said:

I changed my site to https using the Let's encrypt certificate.

Therefore I uncommented the respective lines in the .htaccess.

But the leafletmap module doesn't seem to get this right and includes the css files in the head of the page with http only. So the page doesn't load because of mixed content.

Where can I fix this so as the https files become included?

Thanks for help.

I don't use this module so maybe not the best person to respond, but it looks like it should load the https version. It was changed to this in this commit: https://github.com/madebymats/FieldtypeLeafletMapMarker/commit/eb0c1e703a0b3eb5bc6c00aaee44eb59a6d22dfe#diff-b979b991c53396a5160add7bfa0c8dcb

 

Share this post


Link to post
Share on other sites

Totally OT, but is there any reason this module loads 0.7.3 of leaflet when they are up to 1.3.4?

Share this post


Link to post
Share on other sites
42 minutes ago, adrian said:

Totally OT, but is there any reason this module loads 0.7.3 of leaflet when they are up to 1.3.4?

I think the reason is just lack of time on the part of the module devs, but it would also need to be adapted because of breaking changes. I have been thinking of giving another shot at debugging this thoroughly, but have lacked time and energy.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks Adrian

I changed all these lines and now it works. Sort of.

But:
the leaflet.js script that is now loaded still contains links to unsecure sites. I get the following errors/warning:

Quote

Gemischte (unsichere) Anzeige-Inhalte von "http://c.tiles.wmflabs.org/bw-mapnik/18/136622/92145.png" werden auf einer sicheren Seite geladen. leaflet.js:7:7263

 

Share this post


Link to post
Share on other sites
2 minutes ago, joe_ma said:

Thanks Adrian

I changed all these lines and now it works. Sort of.

But:
the leaflet.js script that is now loaded still contains links to unsecure sites. I get the following errors/warning:

 

Perhaps you can just grab a copy of leaflet.js and serve it up locally. Then you can edit it to replace those http calls with https

Share this post


Link to post
Share on other sites
On 8/29/2018 at 8:23 PM, Beluga said:

I think the reason is just lack of time on the part of the module devs, but it would also need to be adapted because of breaking changes. I have been thinking of giving another shot at debugging this thoroughly, but have lacked time and energy.

Bah, this was my own blunder: I had failed to include leaflet.awesome-markers.css when I made my attempt to bump those versions. I had also overlooked that the readme has $map->getLeafletMapHeaderLines(); that should be echoed to our head element (the readme in Github is hard to read, so copying to a text editor helped).

With this in mind I modified the getLeafletMapHeaderLines function MarkupLeafletMap.module like so to get all the latest hotness:

$lines .= <<<LINES
<!-- Styles supporting the use of Leaflet.js -->
<link rel="stylesheet" type="text/css" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css" />
<link rel="stylesheet" type="text/css" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css" />
<link rel="stylesheet" type="text/css" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css" />

<!-- Scripts supporting the use of Leaflet.js -->
<script type="text/javascript" src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js"></script>
<script type="text/javascript" src="https://unpkg.com/leaflet.markercluster@1.4.1/dist/leaflet.markercluster.js"></script>
<script type="text/javascript" src="https://unpkg.com/leaflet-providers@1.4.0/leaflet-providers.js"></script>
<script type="text/javascript" src="{$url}MarkupLeafletMap.js"></script>

<!-- Extend Leaflet with Awesome.Markers -->
<link rel="stylesheet" type="text/css" href="https://unpkg.com/drmonty-leaflet-awesome-markers@2.0.2/css/leaflet.awesome-markers.css" />
<script type="text/javascript" src="https://unpkg.com/drmonty-leaflet-awesome-markers@2.0.2/js/leaflet.awesome-markers.js"></script>

 

Share this post


Link to post
Share on other sites

I would like to replace the Ryan's original MarkupGoogleMap with this module. I installed this MarkupLeafletMap and tried to change the Map Marker fieldtype to Leaflet Map Marker. But it seems these fieldtypes are not compatible with each other. 

What should I do to change the old field with its over 200 pages to use this fieldtype?

Share this post


Link to post
Share on other sites

Hi everybody! And thanks for Processwire!

The Leaflet Map module appears to have the same issue that the gmap-based Map Marker Map module. The map will not render if placed inside ajax-driven repeater item as one of its data fields because there's no leaflet map initialization after the ajax call. Here's a small fix to be added at the bottom of InputfieldLeafletMapMarker.js file:

//A patch for displaying the map inside ajax repeater items
	$(".InputfieldHeader").on('click',function(event) {
			window.setTimeout(function(){
				var $t = $(event.target).siblings('.InputfieldContent').find('.InputfieldLeafletMapMarkerMap');
				InputfieldLeafletMapMarker.init($t.attr('id'), $t.attr('data-lat'), $t.attr('data-lng'), $t.attr('data-zoom'), $t.attr('data-type'), $t.attr('data-provider'));
			},500);
		});
	});

The delay is rather arbitrary, 500 ms works for me.

  • Like 3

Share this post


Link to post
Share on other sites

A quick query on this module if anyone might be able to shed some light. I have a staging site running PW 3.0.61 and version 2.8.1 of this module, but in the field settings page I'm getting a "Error geocoding address" message.

I also have a local version of the same site, running PW 3.0.98 and version 3.0.3 of the module (from the latest branch on Github – upgrading in the PW admin didn't seem to give the latest version), giving the exact same error. Nothing seems to be being blocked from executing.

I also have another two sites using different versions of PW and the module, and they're all working perfectly – I can't see any difference in the way they're set-up.

There's a console error as well:

Source map error: request failed with status 404
Resource URL: http://xxxxxx/wire/templates-admin/styles/AdminTheme.css?v=14k
Source Map URL: AdminTheme.css.map[Learn More]

Share this post


Link to post
Share on other sites

For the PW 3.0.61 site, make sure you use the PW3 branch on github.  Maybe that is why it isn't working properly?

I believe the console error you are getting about the source map missing has been fixed in Processwire.  Upgrade Processwire to the latest dev release and that error should go away.

Share this post


Link to post
Share on other sites
16 hours ago, gmclelland said:

For the PW 3.0.61 site, make sure you use the PW3 branch on github.  Maybe that is why it isn't working properly?

1

Sorry, I meant to put something else as well and forgot. To clarify:

On the two sites I'm looking at/comparing – 

 

Site 1  –  live site is PW 3.0.61 with module 2.8.1, local is PW 3.0.98 with module 3.0.2

Site 2 – live site is PW 3.0.62 with module 3.0.2, local is PW 3.0.98 with module 3.0.2

For site 1 the leaflet module works perfectly on live and local, site 2 the module doesn't work on either, even though the local site versions are exactly the same.

Hopefully that's a bit clearer.

Share this post


Link to post
Share on other sites

@Mats - something strange is happening when I upgrade the module from 3.0.2 to 3.0.3 using Processwire's Upgrade module.  When I try to upgrade the module, it goes from 3.0.2 to 2.8.1 instead of 3.03.

I wonder if you need to update the module's version or branch on processwire.com modules directory?

If I manually download the github version on the PW3 branch, I get 3.0.3 which is the correct version.

@houseofdeadleg - Maybe you could try geocoding that same address on the site that is working to make sure it isn't something wrong with the address itself?

I would recommend upgrading those sites that are on 3.0.61 and 62.  There has been many changes and bugs fixed since then.  Using the Processwire Upgrade module makes it easy to upgrade.  Sorry, I'm not sure what else the problem could be?

Share this post


Link to post
Share on other sites

I'm thinking to switch from Google Maps to Leaflet Maps to avoid adding payment details on Google but on the readme of this module says:

Quote

Google maps geocoding is still used for geocoding default lat/lng values under field settings but the geocoding on page editing uses Per Liedmans [leaflet-control-geocoder] (https://github.com/perliedman/leaflet-control-geocoder)

So I'm confused! Does this module needs a Google Geocoding API key in order to work or not???

Share this post


Link to post
Share on other sites

I also just tested on another fresh site.  If I try to install fieldtype-leaflet-map-marker via Modules > Install > Add New, it installs 2.8.1 instead of 3.0.3 on my Processwire 3.0.120 site.

I'm not sure why?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.1.16
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
    • By MoritzLost
      UPDATE: I have published a stable version of this module!
      Discussion thread:
      Github: https://github.com/MoritzLost/TextformatterPageTitleLinks
      ---
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution 🙂
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright 😅
      You can download the module from Github:
      https://github.com/MoritzLost/TextformatterPageTitleLinks
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.
      Screenshots:

      Video:
       
      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors V 1.01 (view issue)
      Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en  Github:
      https://github.com/LuisSantiago/ProcessElFinder/
      I hope you like it.
    • By BitPoet
      I'm really in love with FormBuilder, but the one thing missing to match all my end users' expectations were repeatable field groups. Think repeaters, in ProcessWire terms. Our primary application of PW is our corporate intranet, so "lines" of fields are quite common in the forms I build. We have all kinds of request forms where the information for a varying number of colleagues needs to be entered (from meal order to flight booking request) and where it is simply impractical to send a form for each, and I don't want to clutter my forms with multiple instances of fields that may only get used ten percent of the time.
      That's why I started to build FormBuilderMultiplier (link to GitHub).
      What it does:
      Adds an option to make a regular Fieldgroup repeatable Lets you limit the number of instances of a Fieldgroup on the form Adds an "Add row" button the form that adds another instance of the Fieldgroup's fields Adds a counter suffix at the end of every affected field's label Stores the entered values just like regular fields Makes the entered values available in preview and email notifications Supports most text based fields, textareas and selects (really, I haven't had enough time to test all the available choices yet) What it doesn't do (yet):
      Support saving to ProcessWire pages (i.e. real Repeaters) I haven't tested all the validation stuff, Date/Time inputs etc. yet, but since I'm utterly swamped with other stuff at work, I didn't want to wait until I have it polished. Any feedback is welcome. There might also be some issues with different output frameworks that I haven't encountered yet. The forms I work with mostly use UIKit.
      Status:
      Still alpha, so test well before using it in the field.
      Known issues:
      When rows are added, the form's iframe needs to be resized, which isn't completely clean yet.
      How it works:
      The Fieldgroup settings are added through regular hooks, as is the logic that adds the necessary field copies for processing the form and displaying previews.
      "Multiplied" field instances are suffixed with _NUM, where NUM is an incremental integer starting from 1. So if you have add two fields named "surname" and "givenname" to a fieldgroup and check the "multiply" checkbox, the form will initially have "surname_1" and "givenname_1" field (I'm still considering changing that to make the risk to shoot oneself into the foot by having a regular "surname_1" field somewhere else in the form less likely).
      When a "row" is added, the first row is cloned through JS and the counter in the fields' IDs, names and "for" attributes as well as the counter in the label are incremented before appending the copies to the Fieldset container in the form.
      To keep backend and frontend in sync, a hidden field named [name of the fieldset]__multiplier_rows is added to the form. Both the backend and the frontend script use this to store and retrieve the number of "rows".
      ToDo:
      Naturally, add the option to store the data in real repeaters when saving to pages. Do a lot of testing (and likely fixing). Make a few things (like the "Add row" button label etc.) configurable in field(set) context. Add a smooth API to retrieve the multiplied values as WireArrays. The mandatory moving screenshot: