I see there is no ability to set map settings, which I need. I do see though there is an issue with patches to set zoom https://drupal.org/node/1711668.
I would really like to be able to set all map options.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

2pha’s picture

Here is a patch for the latest dev that adds a textfield to input json that allows for setting of any of the map options. (zoom, minZoom, maxZoom, etc).
to set the options, you would enter something like:
{"zoom":5, "minZoom":10, "maxZoom":8}
map options are detailed at: http://leafletjs.com/reference.html#map-options

2pha’s picture

Status: Active » Needs review

Changing to "needs review"

2pha’s picture

Here is a new patch that includes the previous patch and also adds token support in the icon path and replacement pattern support in the icon path in leaflet_views.
You probably want to use this patch instead of the one above.

2pha’s picture

Title: Ability to set map settings (zoom, minZoom, maxZoom etc.) » Ability to set map settings (zoom, minZoom, maxZoom etc.) and token support. patch attached
Component: User interface » Code
2pha’s picture

Last patch had a bug.
New patch attached

AaronBauman’s picture

#5 does what it says.
This is a great feature, thanks for the patch 2pha

anyone else?
RTBC?

zilla’s picture

seems RTBC, though by a small C ;)

will it also need documentation and a revised readme of some kind (maybe with samples or just a direct link to leaflet settings page)?

control.space’s picture

#5 patch worked perfectly. I like the json input format.

Thanks 2pha.

geodaniel’s picture

This is just what I was looking for! It works nicely for the field display on nodes and in a view.

rootwork’s picture

Status: Needs review » Reviewed & tested by the community

This is great. If I may be so bold after several positive reviews, I'm marking this RTBC.

jday’s picture

This patch is an excellent addition to the module, I hope it gets committed.

danon1981’s picture

Applied the patch successfully, works great!

briand44’s picture

#5 patch worked on basic node displays and in views but I am having problems getting it to work on a panelized node. When configuring the advanced settings through the pane it doesn't appear to save the values.

control.space’s picture

Hey, 2pha, quick question. In #1918170: Use tokens in icon url at #11, you state that this patch adds token support for the marker url in views. I see the control and try it, but it doesn't seem to work. e.g. I get [business_type].png instead of say bookstores.png (And, yes, the field is added to the view)
Am I missing something? Thanks.

2pha’s picture

Is the field for the token above/before the field for the icon where you are using the token?

control.space’s picture

Not sure what you mean by "field for the icon"...
My fields, as displayed in the Replacement Patterns tab,

[title] == Content: Title
[language] == Content: Language
[field_geolocation] == Content: Geolocation (don't mind the name it's a geofield)
[field_business_type] == Content: Business Type

The field I want to take over the marker's image file name comes last.
I place it in the marker url input like so: "[field_business_type].png"

And that's what I get in the source markup: [field_business_type].png, instead of bookstores.png, drugstores.png etc

2pha’s picture

sorry...bit of a brain fart with my last comment...
Are you sure you applied the correct patch?
I can not reproduce the issue...the replacement patterns work for me.

control.space’s picture

Sorry for the late reply. Replacement patterns for the markers do work after all.

I've been erroneously trying it on a overlay view generated with pvhee's sandbox Leaflet Views Data. I thought, since custom marker data are carried over, the replacement patterns would do too, but they don't. Oh well.

Thanks for your time.

Juc1’s picture

I just tried the #5 patch (= September 16) against the current dev release (= October 6) but I got hunk errors - should it work, or if not can anyone please update the patch or tell me a github URL where I can download the right dev or patched version?

Thanks...

Juc1’s picture

Or if not is there a hacky way to change (decrease) the default zoom - can anyone please tell me in which file the default zoom is set?

Thanks...

gcb’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

@2pha some cool stuff here. A little hard to work with, however: you've rolled 2 unrelated features into a single patch, and some of this duplicates functionality from other tickets.

Also, adding a raw text config field seems sub-optimal. Creating form fields isn't terribly difficult: see #1711668, where form fields have been created for some of these settings. If we're going to add this to the codebase, we want to add form fields for these values and handle the formatting of the api settings in code.

I'm marking this "needs work", but I'd like to see these featuressplit out into their own issues & patches and close this one out. If no one wants to write the form fields I'll turn it into a feature request and handle it when I can.

2pha’s picture

I think it would be silly to add form fields for every map setting. It would mean a massive form and would need to be updated whenever new map options were added to the leaflet api. Other committers to the leaflet module seem to like my approach.
Yes it duplicates features from other tickets but I tried to comment in each of those tickets to direct people to this one.
Have any of the features that this patch addresses been committed yet?

briand44’s picture

I've reopened Ability to disable scrollWheelZoom because of comment #21 and I re-created the patch against the latest dev version.

robertwb’s picture

Checking in on this - @2pha - I want to look juist at the token support. Wouldn't this be well done by leveraging the existing html divIcon facility? Of course, I don't actually know how to get that divIcon to work, but it seems that we can set all of the css needed in the divIcon for leaflet, then render the individual marker settings from a ReWritten field, thus eliminating the need for additional settings in the Leaflet Map settings area. Leaflet dfocs on divIcon here
http://www.coffeegnome.net/labels-in-leaflet/

Your other settings seem reasonable - maybe think of soplitting these into separate patches? BTW - am also posting this on the related issue

2pha’s picture

I no longer use this module as I have created my own mapping module that better fits my needs.
If I ever use this module again and need the futures I would not mind patching, but I doubt it will happen any time soon.