Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/scheduler_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
- name: 📍 Generate DojoMap from Earth/Japan data
run: |
bundle exec rake upsert_dojos_geojson
bundle exec rake compact_geojson

- name: 🆙 Commit latest data to update DojoMap (if any)
run: |
Expand All @@ -79,6 +80,7 @@ jobs:

# Save GeoJSON data to render DojoMap
git add dojos.geojson
git add dojos.min.geojson

# Commit changed files above
git commit -m '🤖 Upsert Earth/Japan data for DojoMap'
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ task(:get_data_from_japan) { ruby 'get_data_from_japan.rb' }
task(:cache_dojo_logos) { ruby 'cache_dojo_logos.rb' }
task(:cache_data_as_yaml) { ruby 'cache_data_as_yaml.rb' }
task(:upsert_dojos_geojson) { ruby 'upsert_dojos_geojson.rb' }
task(:compact_geojson) { ruby 'compact_geojson.rb' }

# GitHub - gjtorikian/html-proofer
# https://github.com/gjtorikian/html-proofer
Expand Down
3 changes: 0 additions & 3 deletions cache_data_as_yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
# Earth data: from RasPi's Clubs API: https://clubs-api.raspberrypi.org
EARTH_YAML_PATH = '_data/earth.yml'

# Ensure _data directory exists
FileUtils.mkdir_p('_data')

# Load Earth data (use string keys, not symbols)
dojos_earth = JSON.load(File.read('dojos_earth.json'),
nil,
Expand Down
16 changes: 14 additions & 2 deletions compact_geojson.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
#!/usr/bin/env ruby
require 'json'

# Just compact it for better loading by Computer
# Create a minified version of dojos.geojson for production use
geojson = JSON.load(File.read("dojos.geojson"))
File.open('dojos.geojson', 'w') do |file|

# Write minified version (no whitespace)
File.open('dojos.min.geojson', 'w') do |file|
JSON.dump(geojson, file)
end

# Calculate size reduction
original_size = File.size("dojos.geojson")
minified_size = File.size("dojos.min.geojson")
reduction = ((original_size - minified_size) * 100.0 / original_size).round(1)

puts "✅ Created dojos.min.geojson"
puts " Original: #{(original_size / 1024.0).round(1)} KB"
puts " Minified: #{(minified_size / 1024.0).round(1)} KB"
puts " Reduction: #{reduction}%"
Empty file added dojos.min.geojson
Empty file.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<body>
<div
class="geolonia"
data-geojson="./dojos.geojson"
data-geojson="./dojos.min.geojson"
data-lat="35.6809591"
data-lng="139.7673068"
data-zoom="5"
Expand Down
2 changes: 1 addition & 1 deletion world.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<body>
<div
class="geolonia"
data-geojson="./dojos.geojson"
data-geojson="./dojos.min.geojson"
data-lat="35.6809591"
data-lng="139.7673068"
data-zoom="0"
Expand Down