Newer
Older
tools / imgAtt2desc.rb
@HIROSE Yuuji HIROSE Yuuji on 12 Mar 2018 509 bytes Add scripts
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'json'
collection = JSON.parse(ARGF.read)
imgtop = ENV['IMGTOP'] || 'https://www.koeki-prj.org/a/sktmap/2017'
theme  = ENV['THEME']  || 'theme'
urldir = imgtop + "/" + theme

for f in collection['features'] do
  prop = f['properties']
  if imgf=prop['画像ファイル名'] then
    files = imgf.split(';').collect{|f|
      sprintf("{{%s/%s}}", urldir, f)}.join("\n")
    prop['description'] += "\n"+files
  end
end
print JSON.pretty_generate(collection)