davidjvitale / jekyll-leaflet Goto Github PK
View Code? Open in Web Editor NEW๐บ๏ธ Create leatlet.js maps in Jekyll
Home Page: https://davidjvitale.com/tech/jekyll-leaflet/
License: MIT License
๐บ๏ธ Create leatlet.js maps in Jekyll
Home Page: https://davidjvitale.com/tech/jekyll-leaflet/
License: MIT License
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 %}
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,
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 %}
Added the gem according to the instructions at: https://davidjvitale.com/tech/jekyll-leaflet/getting-started/
When executing bundle exec jekyll serve --baseurl ''
I get the following error:
Error: Liquid syntax error (line 3): Unknown tag 'leaflet_map'
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.
{% capture reproduce %}
{% for i in (1..5) %}
{% leaflet_marker
{
"latitude": {{ forloop.index }},
"longitude": {{ forloop.index }}.
}
%}
{% endfor %}
{% endcapture %}
{% for lm in reproduce %}
{{ lm }}
{% endfor %}
{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. } }
{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. } }
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.
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.
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.