Skip to main content

Comprehensive Python package offering Nepal's geographical data including GeoJSON for all 77 districts and 7 provinces. Ideal for GIS, mapping, and data visualization projects for Nepal.

Project description

Nepal Geo Data: Complete Geographical GeoJSON for Nepal

PyPI version License: MIT

Nepal Geo Data is the most comprehensive Python package for Nepal's geographical data. It provides high-quality GeoJSON for all 77 Districts, 7 Provinces, and 753 Local Levels (Municipalities/Gaunpalikas), along with rich metadata (Nepali names, official codes).

Whether you are building a dashboard in Streamlit, analyzing spatial data with Pandas/GeoPandas, or creating interactive maps with Plotly/Folium, this package provides the map data you need with a simple API.

Key Features

  • Complete Administrative Coverage:
    • 7 Provinces (Pradesh)
    • 77 Districts (Jilla)
    • 753 Local Levels (Palikas/Municipalities) - New in v0.2.0!
  • Rich Metadata: Includes English names, Nepali names (e.g., "Kathmandu", "काठमाडौँ"), and official government codes.
  • Zero Dependencies: Works with standard Python libraries.
  • GIS Ready: Outputs standard FeatureCollections compatible with GeoPandas (gpd.read_file), Folium, and Plotly.
  • Backward Compatible: Preserves legacy behavior (UPPERCASE district keys) for existing projects.

Installation

Install via pip from PyPI:

pip install nepal-geo-data

Quick Start & Tutorials

1. Districts and Provinces

Get lists and details of administrative boundaries.

import nepal_geo_data

# Print the built-in guide
nepal_geo_data.help()

# Get all district names
districts = nepal_geo_data.get_districts()
print(districts) 
# Output: ['ACHHAM', 'ARGHAKHANCHI', ..., 'UDAYAPUR']

# Get details for a specific district (Case Insensitive)
ktm = nepal_geo_data.get_district("Kathmandu")
print(ktm['properties']['district_name_np'])  # Output: काठमाडौँ
print(ktm['properties']['province_name_en'])  # Output: Bagmati Province

# Get all districts in a specific province (e.g., Karnali Province / Province 6)
karnali_districts = nepal_geo_data.get_province_districts(6)

2. Working with Municipalities (New!)

The package now supports all 753 Local Levels.

Get All Municipalities

# Get a list of ALL municipalities in Nepal
all_munis = nepal_geo_data.get_municipalities()
print(f"Total Municipalities: {len(all_munis)}") # 753
print(all_munis[:5]) 

Filter Municipalities by District

The get_municipalities function accepts an optional district_name parameter.

# Get only municipalities in 'Jhapa' district
jhapa_munis = nepal_geo_data.get_municipalities("Jhapa")

print(f"Municipalities in Jhapa: {len(jhapa_munis)}")
for muni in jhapa_munis:
    print(f"- {muni}")
    
# Output:
# - Arjundhara
# - Bhadrapur
# - Birtamod
# ...

Get Municipality Details & Map Data

Search for a specific municipality to get its full GeoJSON (coordinates, codes, Nepali name).

# Get data for 'Kathmandu Metropolitan City'
# You can search by English name (case-insensitive)
ktm_metro = nepal_geo_data.get_municipality("Kathmandu Metropolitan City")

if ktm_metro:
    props = ktm_metro['properties']
    print(f"Name (EN): {props['gapa_napa']}")      # Kathmandu Metropolitan City
    print(f"Name (NP): {props['gapa_napa_np']}")  # काठमाडौँ महानगरपालिका
    print(f"Type: {props['type']}")                # Mahanagarpalika
    print(f"District ID: {props['district_code']}")
    
    # Access geometry for plotting
    # geometry = ktm_metro['geometry']

3. Integration with Plotly (Choropleth Maps)

Create stunning interactive maps using the GeoJSON data.

import plotly.express as px
from nepal_geo_data import get_geojson

# Load District GeoJSON
nepal_geojson = get_geojson()

# Dummy data dictionary
data_dict = {'KATHMANDU': 100, 'LALITPUR': 80, 'BHAKTAPUR': 60}
# Convert to list of dicts for Plotly
data = [{'District': k, 'Value': v} for k, v in data_dict.items()]

fig = px.choropleth_mapbox(
    data_frame=data,
    geojson=nepal_geojson,
    locations='District',
    featureidkey="properties.DISTRICT", # Using the backward-compatible key
    color='Value',
    center={"lat": 28.3949, "lon": 84.1240},
    mapbox_style="carto-positron",
    zoom=6,
    title="Nepal District Density Map"
)
fig.show()

API Reference

get_districts()

Returns a sorted list of all 77 district names (UPPERCASE).

get_district(name)

Returns the GeoJSON feature for a district.

  • name: Name of the district (case-insensitive).
  • Returns: Dictionary with type, properties, and geometry.

get_province_districts(province_id)

Returns a list of district names in a specific province.

  • province_id: Integer ID of the province (1-7).

get_municipalities(district_name=None)

Returns a list of municipality names.

  • district_name (Optional): If provided, filters the list to return only municipalities within that district.
  • Returns: Sorted list of strings.

get_wards(municipality_name)

Returns a list of ward numbers (integers) for a specific municipality.

  • municipality_name: Name of the municipality (case-insensitive).
  • Returns: List of integers (e.g., [1, 2, 3]).

get_municipality(name)

Returns the GeoJSON feature for a specific municipality.

  • name: Name of the municipality (English, case-insensitive).
  • Returns: Dictionary with geometry and rich metadata (Wards, Website, Area).

get_geojson() / get_provinces_geojson() / get_municipalities_geojson()

Returns the complete raw GeoJSON FeatureCollection for Districts, Provinces, or Municipalities respectively.

Contributing

We welcome contributions! GitHub Repository: https://github.com/bedbyaspokhrel/nepal-geo-data

License

MIT License - see the LICENSE file for details.


Keywords: Nepal GIS, Nepal Map Python, GeoJSON Nepal, Nepal Districts Data, Nepal Municipalities, Local Level Nepal, Gaunpalika, Nepal Provinces JSON, Python GIS Nepal.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nepal_geo_data-0.3.0.tar.gz (4.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nepal_geo_data-0.3.0-py3-none-any.whl (4.5 MB view details)

Uploaded Python 3

File details

Details for the file nepal_geo_data-0.3.0.tar.gz.

File metadata

  • Download URL: nepal_geo_data-0.3.0.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nepal_geo_data-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5aa4fa312299ac91b7cd955c0abd06e337696280dfe2c37d1bb99fb6411f43c6
MD5 97a0a6a1ab84dec09ae3678261989492
BLAKE2b-256 5ef24d5f1bbee49d0aa0412820e8e804b2ec61f9dc3a7370a6dca528ddebd136

See more details on using hashes here.

File details

Details for the file nepal_geo_data-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: nepal_geo_data-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nepal_geo_data-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a31276c88bceb431493b99878a3ebd267e584867c7c74fabcf7d561c6d7490b5
MD5 6d6a0e1448eee76df2dec64e8cc7f600
BLAKE2b-256 d43e0bed7338701dd8188937970e0fbdf1e3f2607d32df26a28c6d626b47c89f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page