Giter Site home page Giter Site logo

davidjvitale / jekyll-leaflet Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 16.0 1.34 MB

๐Ÿ—บ๏ธ Create leatlet.js maps in Jekyll

Home Page: https://davidjvitale.com/tech/jekyll-leaflet/

License: MIT License

Ruby 12.45% HTML 0.26% JavaScript 87.29%

jekyll-leaflet's People

Contributors

davidjvitale avatar fchavat avatar jvanulde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jekyll-leaflet's Issues

[Feature request] Use addresses as well as locations

I have a data file containing locations encoded using a mixture of lat / long pairs and addresses. I would like to be able to add markers for the addresses if possible.

Ideally I could then plot all of the locations in one map using something like...

{% leaflet_map { "zoom" : 5,
                  "center" : [47, 10],
                "providerBasemap": "OpenStreetMap.HOT"} %}
    {%- for item in site.data.map -%}
        {% if item.location.latitude and item.location.longitude %}
            {% leaflet_marker { "latitude" : {{item.location.latitude}},
                        "longitude" : {{item.location.longitude}} } %}
        {% endif %}
    {% if item.location.address %}

    {% endif %}
  {% endfor %}
{% endleaflet_map %}

how to change the icons ?

Hello,
Could you explain how to change the icon marker and, according to the issue #7, how to change the image size by using divId.

Thank you,

changing map height and css

Very nice plugin. Very easy to use. Thank you for making it available.

I have been looking into not having it 300px high, and looking through the code I figures out that it was possible to use a custom id for the leaflet using the "divId" keyword. This allows me to set the css as I want and not be bound by the default 300px.

This is not in the docs, so I suggest adding something like the below text to
https://github.com/DavidJVitale/jekyll-leaflet/blob/master/docs/getting-started.md

I can make a pull request, if you prefer, but i figure that you may want a consistency in writing style :-)

again, thanks for a nice plugin.


It is possible to customize the leaflet style, ie. height, margins, and such. This is done using the divId keyword which sets the id of the leaflet map div.

It is done like so

{% raw %}
{% leaflet_map { "divId": "myleaflet" } %}
{}
{% endleaflet_map %}
{% endraw %}

Liquid for loop to create leaflet_marker doesn't work as expected (repeating info from first element)

Hello.

Thank you for the work you have done on this gem, it is helping me!

Today I was having trouble trying to generate the leaflet_markers of the map through a Liquid forloop on Jekyll. The problem is that all the markers generated had the information of the first created on the forloop.

You can reproduce the problem with:

      {% capture reproduce %}
        {% for i in (1..5) %}
          {% leaflet_marker 
            {
              "latitude": {{ forloop.index }},
              "longitude": {{ forloop.index }}.
            }  
          %}
        {% endfor %}
      {% endcapture %}

      {% for lm in reproduce %}
        {{ lm }}
      {% endfor %}

Expected result:

{id: "f82d0ff366578fb23102b3be3e4d350c", type: "LeafletMarker", value: { "latitude": 1, "longitude": 1. } },
{id: "24a36c6449a3451d6a6d9f0a6d165f26", type: "LeafletMarker", value: { "latitude": 2, "longitude": 2. } }, 
{id: "3a4b4e4d949d12d278aa0c9b60e74ea0", type: "LeafletMarker", value: { "latitude": 3, "longitude": 3. } },
{id: "f49da7d4a91fb17300807cd026962774", type: "LeafletMarker", value: { "latitude": 4, "longitude": 4. } }, 
{id: "44b14612a326454314893f0962ffc1d2", type: "LeafletMarker", value: { "latitude": 5, "longitude": 5. } }

Actual ressult

{id: "f82d0ff366578fb23102b3be3e4d350c", type: "LeafletMarker", value: { "latitude": 1, "longitude": 1. } },
{id: "24a36c6449a3451d6a6d9f0a6d165f26", type: "LeafletMarker", value: { "latitude": 1, "longitude": 1. } }, 
{id: "3a4b4e4d949d12d278aa0c9b60e74ea0", type: "LeafletMarker", value: { "latitude": 1, "longitude": 1. } },
{id: "f49da7d4a91fb17300807cd026962774", type: "LeafletMarker", value: { "latitude": 1, "longitude": 1. } }, 
{id: "44b14612a326454314893f0962ffc1d2", type: "LeafletMarker", value: { "latitude": 1, "longitude": 1. } }

Why this happen?

As far as I could see (here and here) initialize method will be only called once on a for loop, so, using an **@**instance variable on the render will make first element being rendered each time.

How to fix

The only thing we have to do to fix that is changing (on leaflet-marker.rb) the lines

            @input = parse_liquid_output_in(@input, context)
            '{id: "' + SecureRandom.hex + '",
              type: "LeafletMarker",
              value: ' + @input + '},'

to

            value = parse_liquid_output_in(@input, context)
            '{id: "' + SecureRandom.hex + '",
              type: "LeafletMarker",
              value: ' + value + '},'

(As it is being done on leaflet-geojson.rb)
Fixed on a forked repo and worked perfectly. I would be great if this fix can be included as soon as possible so we don't have to use a forked gem.

Thank you again for the work you have done.
Greetings.

Is it possible to customise the geojson objects (stroke colors, width ...) ?

My geojson file contains some custom properties in the features like "stroke":"#555555","stroke-width":4, to change the aspect of a path. I see in the the code that the full geojson object is added to the map in _addGeoJSONObjToMap, also the html debugger shows the correct values but my objects are still with the defaut style.

gem not working on github.io

I was adding the gem to my github.io page. There is a build error with this gem:
The tag leaflet_map on line 19 in index.html is not a recognized Liquid tag
I do have:

group :jekyll_plugins do
  gem 'jekyll-paginate'
  gem 'jekyll-sitemap'
  gem 'jekyll-leaflet'
end

in my GemFile

and:

plugins:
  - jekyll-paginate
  - jekyll-sitemap
  - jekyll-leaflet

in my _config.yml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.