Coder Social home page Coder Social logo

centroid-lookup's Introduction

Centroid Lookup

Lookup up administrative areas from csv or xlsx file and output centroids into copy of csv or xlsx.

Installation

pip install git+https://github.com/kerrycobb/centroid-lookup

Usage

View help menu showing all available commands centroid-lookup --help

Usage: centroid-lookup [OPTIONS] COMMAND [ARGS]...

  Look up centroid of GADM administrative areas in csv file or excel
  spreadsheet.

  INPUT can be csv or xlsx

Options:
  -h, --help  Show this message and exit.

Commands:
  adm0  Look up centroid of level 0 GADM administrative areas
  adm1  Look up centroid of level 1 GADM administrative areas
  adm2  Look up centroid of level 2 GADM administrative areas
  adm3  Look up centroid of level 3 GADM administrative areas
  adm4  Look up centroid of level 4 GADM administrative areas
  adm5  Look up centroid of level 5 GADM administrative areas

View help menu showing options for each command centroid-lookup adm5 --help

Usage: centroid-lookup adm5 [OPTIONS] INPUT

  Look up centroid of level 5 GADM administrative areas

Options:
  -0, --adm0 TEXT    Adm level 0 column header in input file
  -1, --adm1 TEXT    Adm level 1 column header in input file
  -2, --adm2 TEXT    Adm level 2 column header in input file
  -3, --adm3 TEXT    Adm level 3 column header in input file
  -4, --adm4 TEXT    Adm level 4 column header in input file
  -5, --adm5 TEXT    Adm level 5 column header in input file
  -o, --output TEXT  Path to output file. Defaults to centroid-lookup.out.csv
  -s, --sheet TEXT   sheet name if input is excel spreadsheet
  -h, --help         Show this message and exit.

Examples

Lookup country level centroids from test-adm0.csv where country names are in column named name_0.

centroid-lookup adm0 --adm0 name_0 test-adm0.csv

Lookup county or level 2 area from test-adm2.xlsx where country, state, and county column names are name_0, name_1, and name_2 respectively.

centroid-lookup adm2 --adm0 name_0 --adm1 name_1 --adm2 name_2 test-adm2.xlsx

Known issues

Alaska > Aleutians West centroid location way off

Util

util/compute_gadm_centroids.py is a script for downloading GADM data and computing centroids. This is how the data that are downloaded when installing centroid lookup were generated.

centroid-lookup's People

Contributors

kerrycobb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.