Jump to content
Mats

Module: Leaflet Map

Recommended Posts

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By eelkenet
      Hi! I've created a small Inputfield module called InputfieldFloatRange which allows you to use an HTML5 <input type="range" ../> slider as an InputField. I needed something like this for a project where the client needs to be able to tweak this value more based on 'a feeling' than just entering a boring old number. Maybe more people can use this so I'm hereby releasing it into the wild. 
      EDIT: You can now install it directly from the Modules directory: http://modules.processwire.com/modules/inputfield-float-range/
       
      What is it?
      The missing range slider Inputfield for Processwire. 
      What does it do?
      This module extends InputfieldFloat and allows you to use HTML5 range sliders for number fields in your templates.
      It includes a visible and editable value field, to override/tweak the value if required.  
      Features
      Min/max values Precision (number of decimals) Optional step value (Read more) Optional manual override of the selected value (will still adhere to the rules above) Configurable rounding of manually entered values (floor, round, ceil, disable) Usage
      Clone / zip repo Install FieldtypeFloatRange, this automatically installs the Inputfield Create new field of type `Float (range)` or convert an existing `Float`, `Integer` or `Text` field. To render the field's value simply echo `$page->field` Demo
      A field with Min=0, Max=1, Step=0.2, Precision=2

      Field with settings Min=0, Max=200, Step=0.25, Precision=2

       
      Todo
      Make the display-field's size configurable (will use the Input Size field setting)  Hopefully become redundant  
      Changelog
      004 (current version)
      - Make rounding of manually entered values configurable (floor, round, ceil or disable)
      - Fix small JS bug when the value-display field was not displayed
      - Update README
      003
      - Code cleanup, add some ModuleInfo data & LICENSE
      - Submit to PW Modules directory (http://modules.processwire.com/modules/inputfield-float-range/)
      002
      - Fix issue where setting the step value to an empty value created problem with validation
      - Make the display-field optional
      001
      - Initial release
       
      Thanks!
       
       
    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-10-18
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




    • 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. Field widths entered into the Template Field Widths inputfield are only applied if the Edit Template form is submitted with the Template Field Widths inputfield in an opened state. "Collapsed" is the recommended setting if you think you might also use core inputs for setting field widths in a template context. 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 adrian
      Tracy Debugger for ProcessWire
      The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS

       
      Integrates and extends Nette's Tracy debugging tool and adds 35+ custom tools designed for effective ProcessWire debugging and lightning fast development
      The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger
      Modules Directory: http://modules.processwire.com/modules/tracy-debugger/
      Github: https://github.com/adrianbj/TracyDebugger
      A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.
×
×
  • Create New...