opendatakerala / map.opendatakerala.org

LSG Level Portal Based On OSM Data for Map Kerala Campaign
17 stars 3 forks source link

thumbnail for lsg #30

Closed manojkmohan closed 2 years ago

manojkmohan commented 2 years ago

lsg shapes need to be Qid.png with a standard plain stype

asdofindia commented 2 years ago

Accomplished with

const geo = require('./main.json');
const fs = require('fs');

console.log(`Loaded ${geo.features.length} features`)
for (const lsg of geo.features) {
    const qid = lsg.properties.wikidata;
    if (qid) {
        console.log(`Writing ${qid}`)
        fs.writeFileSync(`features/${qid}.geojson`, JSON.stringify(lsg))
    } else {
        console.log(`Skipping undefined`)
    }
}
for file in features/*.geojson
do
  echo "Converting $file"
  if [ ! -f "output/${file%.geojson}.png" ]; then
    timeout -v 10 geojson-renderer -c cache -d 300x150 -e -o "output/${file%.geojson}.png" -f png "$file"
    sleep 1
  fi
done