Giter Site home page Giter Site logo

rameshkunwar / nepal-geojson Goto Github PK

View Code? Open in Web Editor NEW

This project forked from acesmndr/nepal-geojson

0.0 1.0 0.0 10.75 MB

Lightweight bounding coordinates of Nepal's districts

Home Page: https://acesmndr.github.io/nepal-geojson/

License: MIT License

JavaScript 85.30% HTML 14.70%

nepal-geojson's Introduction

Nepal GeoJSON

npm version Build Status license

  • Lightweight (~600KB) packed geojson coordinates of Nepal's district and province boundaries for use with your map.
  • Includes all 77 districts with their headquarters as well as all 7 provinces.
  • Can be used as a NPM package in your project or you can download the generated geojson files and use them as per your need.
  • Since this is a lightweight version of the map, some tradeoff has been made so there isn't minute level accuracy of this map.

Example Usage with Google Maps

Installation

npm i nepal-geojson

Usage

Basic Usage

const nepalGeojson = require('nepal-geojson');
const districtsGeojson = nepalGeojson.districts(); // to get all the geojson for all the districts 
// Now use the district level data to plot it in the map
console.log(districtGeojson);

Advanced Usage

const nepalGeojson = require('nepal-geojson');
const districtsGeojson = nepalGeojson.districts(); // to get all the geojson for all the districts
const provinceOneGeojson = nepalGeojson.province(1); // to get the geojson for all the districts in province 1 similar for other 6 provinces
const kathmanduDistrictGeojson = nepalGeojson.district('KATHMANDU'); // to get the geojson of a single district
// not only does it provide geojson files but also has helper functions to extract necessary details about the districts
const districtsList = nepalGeojson.districtsList(); // to get an array of all the district names
const districtsInfo = nepalGeojson.districtsInfo(); // to get an array of objects of headquarter and province info for all 77 districts
const dhankutaDistrictInfo = nepalGeojson.districtInfo('DHANKUTA'); // to get info about Dhankuta district
const provincesDistrictsInfo = nepalGeojson.provincesWithDistricts(); // returns an array of arrays of provinces each containing info objects of containing districts
const provinceDistrictsInfo = nepalGeojson.provinceWithDistricts(1); // returns array of info objects of districts in province 1

CLI Usage

If you want to use it to generate geojson files in the CLI follow the following steps.

npm i -g nepal-geojson
# to build geojson for all the districts
nepal-geojson country
# to build geojson for a particular district
nepal-geojson district Kathmandu
# to get the geojson for all the districts in province 1
nepal-geojson province 1

The built geojson files are stored in geojson folder.

Alternative to CLI Usage

You could also clone the repo and run the following commands to generate the maps.

# to clone the repo
git clone [email protected]:Acesmndr/nepal-geojson.git
cd nepal-geojson
npm install
# to build geojson for all the districts
npm run country
# to build geojson for a particular district
npm run district Kathmandu
# to get the geojson for all the districts in province 1
npm run province 1

Download Static Geojson

If you don't want to use this npm package and just want the geojson file for the entire country or a particular province I've got you covered. I have built those and uploaded them to generated-geojson folder. You can find them here.

Author

Aashish Manandhar [email protected] http://github.com/acesmndr

License

forthebadge forthebadge

nepal-geojson's People

Contributors

acesmndr avatar dependabot[bot] avatar

Watchers

James Cloos 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.