Initial commit
This commit is contained in:
24
assets/data/geodata.json
Normal file
24
assets/data/geodata.json
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
# generate geojson data for collection items with lat-longs
|
||||
---
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' | where_exp: 'item','item.latitude != nil and item.longitude != nil' -%}
|
||||
{%- assign fields = site.data.theme.metadata-export-fields | split: "," -%}
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{% for item in items %}
|
||||
{
|
||||
"type":"Feature",
|
||||
"geometry":{
|
||||
"type":"Point",
|
||||
"coordinates":[{{ item.longitude }},{{ item.latitude }}]
|
||||
},
|
||||
"properties":{
|
||||
{% for f in fields %}{% if item[f] %}{{ f | jsonify }}: {{ item[f] | jsonify }},{% endif %}
|
||||
{% endfor %}{% if item.image_thumb %}"object_thumb": "{{ item.image_thumb | absolute_url }}",{% endif %}
|
||||
"object_location": "{{ item.object_location | absolute_url }}",
|
||||
"reference_url": "{{ '/items/' | relative_url }}{% if item.parentid %}{{ item.parentid }}.html#{{ item.objectid }}{% else %}{{ item.objectid }}.html{% endif %}"
|
||||
}
|
||||
}{% unless forloop.last %}, {% endunless %}{% endfor %}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user