npm package for providing easy access to regional, district, ward, and street data in Tanzania, including postcodes.
npm install tz-geo-datacomonJS
nextJs
fs error
throw new ERR_IMPORT_ATTRIBUTE_MISSING(url, 'type', validType)
nextJs
fs error
throw new ERR_IMPORT_ATTRIBUTE_MISSING(url, 'type', validType)
bash
npm i tz-geo-data # Latest version
or
npm i tz-geo-data@2.1.5 # Version 2.1.5 for nextJs
`
2. Usage
$3
`javascript
import {
getAllRegions,
getDistrictData,
getWardData,
getStreetsData,
getGeoData,
} from "tz-geo-data";
// Regions list
getAllRegions();
// Districts in region
getDistrictData("regionName");
// Wards in district and region
getWardData("regionName", "districtName");
// Streets and known places in a ward
getStreetsData("regionName", "districtName", "wardName");
// Geolocation Data using postcode
getGeoData("postcode");
`
$3
`javascript
const {
getAllRegions,
getDistrictData,
getWardData,
getStreetsData,
getGeoData,
} = require("tz-geo-data");
// Regions list
getAllRegions();
// Districts in region
getDistrictData("regionName");
// Wards in district and region
getWardData("regionName", "districtName");
// Streets and known places in a ward
getStreetsData("regionName", "districtName", "wardName");
// Geolocation Data using postcode
getGeoData("postcode");
``