{"_id":"@countrystatecity/geojson","_rev":"2-905d456065eb503542114ac498b965fe","name":"@countrystatecity/geojson","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.1":{"name":"@countrystatecity/geojson","version":"1.0.1","keywords":["country-state-city","geojson","leaflet","mapbox","map","geo","browser","frontend","react","vue","svelte","cdn","jsdelivr","lazy-loading","typescript"],"author":{"name":"dr5hn"},"license":"ODbL-1.0","_id":"@countrystatecity/geojson@1.0.1","maintainers":[{"name":"dr5hn","email":"gadadarshan@gmail.com"}],"homepage":"https://github.com/dr5hn/countrystatecity-npm/tree/main/packages/geojson#readme","bugs":{"url":"https://github.com/dr5hn/countrystatecity-npm/issues"},"dist":{"shasum":"e22a80ea52e52b3b00df830e0ebf602b19272253","tarball":"https://registry.npmjs.org/@countrystatecity/geojson/-/geojson-1.0.1.tgz","fileCount":4517,"integrity":"sha512-LoKmvtNZHNARMOwQzgXWvCcB/GzsH97NIWp1bXUYHkoEwtZVNdZ7czVnLRwB4T1+k6VJkYDTO7uEDD7UTZrolA==","signatures":[{"sig":"MEUCIHbMrhXoZ6XXEUmN5wGLKsDycaeC6fGBEyGH8TxnGiYmAiEAsQN00zYJb/LGIU+xkS7W20/PrZ4/EHvmzuTN4PybwEk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26575448},"main":"./dist/index.cjs","type":"module","_from":"file:countrystatecity-geojson-1.0.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./data/*":"./dist/data/*"},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","generate-data":"node scripts/generate-data.cjs"},"_npmUser":{"name":"dr5hn","email":"gadadarshan@gmail.com"},"_resolved":"/tmp/46896280083a2b231ac8d833c83b9e19/countrystatecity-geojson-1.0.1.tgz","_integrity":"sha512-LoKmvtNZHNARMOwQzgXWvCcB/GzsH97NIWp1bXUYHkoEwtZVNdZ7czVnLRwB4T1+k6VJkYDTO7uEDD7UTZrolA==","repository":{"url":"git+https://github.com/dr5hn/countrystatecity-npm.git","type":"git"},"_npmVersion":"10.8.2","description":"Countries, states, and cities as GeoJSON Point FeatureCollections, loaded via jsDelivr CDN","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.0.16","typescript":"^5.9.3","@types/node":"^20.19.19"},"_npmOperationalInternal":{"tmp":"tmp/geojson_1.0.1_1786188797256_0.7781460411207068","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@countrystatecity/geojson","version":"1.0.2","description":"Countries, states, and cities as GeoJSON Point FeatureCollections, loaded via jsDelivr CDN","keywords":["country-state-city","geojson","leaflet","mapbox","map","geo","browser","frontend","react","vue","svelte","cdn","jsdelivr","lazy-loading","typescript"],"author":{"name":"dr5hn"},"license":"ODbL-1.0","repository":{"type":"git","url":"git+https://github.com/dr5hn/countrystatecity-npm.git"},"homepage":"https://github.com/dr5hn/countrystatecity-npm/tree/main/packages/geojson#readme","bugs":{"url":"https://github.com/dr5hn/countrystatecity-npm/issues"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./data/*":"./dist/data/*"},"devDependencies":{"@types/node":"^20.19.19","tsup":"^8.5.1","typescript":"^5.9.3","vitest":"^4.0.16"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","generate-data":"node scripts/generate-data.cjs"},"_id":"@countrystatecity/geojson@1.0.2","_integrity":"sha512-gPywEFvllEvEnOcX05eWQ1NL6NvAjs8ZJ+K1n9LdzlVRB2ERRnj3PNgoencd9ZC98VCumwg1wqP09+ZshhelIQ==","_resolved":"/tmp/da915d5a4459426c90d0c1c81ccb4313/countrystatecity-geojson-1.0.2.tgz","_from":"file:countrystatecity-geojson-1.0.2.tgz","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-gPywEFvllEvEnOcX05eWQ1NL6NvAjs8ZJ+K1n9LdzlVRB2ERRnj3PNgoencd9ZC98VCumwg1wqP09+ZshhelIQ==","shasum":"362f2ce0b3bc4f93d95a221ec3a16dce034df0e9","tarball":"https://registry.npmjs.org/@countrystatecity/geojson/-/geojson-1.0.2.tgz","fileCount":4517,"unpackedSize":26582368,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDof2lSDpvNPoYAcOyWVBSXQhcVKxx/UIgavih/d1J72AiBNxh1msd6MVE2+OXSbXQqp7i08buK6dmTChJIfr8cn3A=="}]},"_npmUser":{"name":"dr5hn","email":"gadadarshan@gmail.com"},"directories":{},"maintainers":[{"name":"dr5hn","email":"gadadarshan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/geojson_1.0.2_1786447252743_0.3831071642781523"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-08T11:33:17.027Z","modified":"2026-08-11T11:20:53.218Z","1.0.1":"2026-08-08T11:33:17.546Z","1.0.2":"2026-08-11T11:20:52.998Z"},"bugs":{"url":"https://github.com/dr5hn/countrystatecity-npm/issues"},"author":{"name":"dr5hn"},"license":"ODbL-1.0","homepage":"https://github.com/dr5hn/countrystatecity-npm/tree/main/packages/geojson#readme","keywords":["country-state-city","geojson","leaflet","mapbox","map","geo","browser","frontend","react","vue","svelte","cdn","jsdelivr","lazy-loading","typescript"],"repository":{"type":"git","url":"git+https://github.com/dr5hn/countrystatecity-npm.git"},"description":"Countries, states, and cities as GeoJSON Point FeatureCollections, loaded via jsDelivr CDN","maintainers":[{"name":"dr5hn","email":"gadadarshan@gmail.com"}],"readme":"# @countrystatecity/geojson\n\n[![npm](https://img.shields.io/npm/v/@countrystatecity/geojson)](https://www.npmjs.com/package/@countrystatecity/geojson)\n[![CI](https://github.com/dr5hn/countrystatecity-npm/workflows/Pipeline/badge.svg)](https://github.com/dr5hn/countrystatecity-npm/actions/workflows/ci.yml)\n\nCountries, states, and cities as GeoJSON `Point` `FeatureCollection`s, loaded via jsDelivr CDN with in-memory LRU caching — same architecture as [`@countrystatecity/countries-browser`](https://www.npmjs.com/package/@countrystatecity/countries-browser).\n\n**Environment:** 🌐 **Browser / Any** (no Node.js dependencies)\n\n## ⚠️ Point geometry only — not boundary polygons\n\nEvery feature in this package is a single `Point` (one coordinate per country/state/city) — the same latitude/longitude already available via `@countrystatecity/countries`. **There are no country/state boundary shapes (polygons) available** — this package cannot power choropleth maps or shape-outline rendering. It exists to save you the one-line transform from `{lat, lng}` to a GeoJSON `Feature`, and to give you CDN-hosted, lazy-loaded `FeatureCollection`s pre-split by country/state for direct use with `L.geoJSON()` (Leaflet) or as a Mapbox GL source.\n\nIf you need real boundary polygons, this package is not it — no such data is currently published upstream.\n\n## ✨ Features\n\n- 📍 250 countries, 5,000+ states, 150,000+ cities as GeoJSON `Point` features\n- 🔄 Lazy loading: per-country state files, per-state city files\n- 🌐 CDN-hosted via jsDelivr with LRU in-memory caching\n- 📝 TypeScript types for `Feature`/`FeatureCollection`/properties per level\n\n## 📦 Installation\n\n```bash\nnpm install @countrystatecity/geojson\n```\n\n## 🚀 Quick Start\n\n```typescript\nimport { getCountriesGeoJSON, getStatesGeoJSON, getCitiesGeoJSON } from '@countrystatecity/geojson';\n\nconst countries = await getCountriesGeoJSON();\n// { type: 'FeatureCollection', features: [{ type: 'Feature', geometry: { type: 'Point', coordinates: [-97, 38] }, properties: { id: 233, name: 'United States', iso2: 'US', iso3: 'USA' } }, ...] }\n\n// Drop straight into Leaflet:\n// L.geoJSON(countries).addTo(map);\n\nconst states = await getStatesGeoJSON('US');\nconst cities = await getCitiesGeoJSON('US', 'CA');\n```\n\n## 📖 API Reference\n\n#### `getCountriesGeoJSON()`\nAll countries as a `FeatureCollection` of `Point` features.\n- **Returns:** `Promise<ICountriesFeatureCollection>`\n\n#### `getCountryGeoJSON(countryCode)`\nA single country as one `Point` feature.\n- **Returns:** `Promise<ICountryFeature | null>`\n\n#### `getStatesGeoJSON(countryCode)`\nAll states/provinces of a country as a `FeatureCollection`.\n- **Returns:** `Promise<IStatesFeatureCollection>`\n\n#### `getCitiesGeoJSON(countryCode, stateCode)`\nAll cities of a state as a `FeatureCollection`.\n- **Returns:** `Promise<ICitiesFeatureCollection>`\n\n#### `getAllCitiesGeoJSONOfCountry(countryCode)`\nAll cities in an entire country, merged into one `FeatureCollection`.\n- **Warning:** loads every state's city file for that country.\n- **Returns:** `Promise<ICitiesFeatureCollection>`\n\n### Configuration\n\n```typescript\nimport { configure, resetConfiguration } from '@countrystatecity/geojson';\n\nconfigure({\n  baseURL: 'https://your-cdn.example.com/geojson',\n  timeout: 8000,\n  cacheSize: 100,\n});\n```\n\n## 🔧 TypeScript Types\n\n```typescript\nimport type {\n  IGeoJSONFeature,\n  IGeoJSONFeatureCollection,\n  ICountryProperties,\n  IStateProperties,\n  ICityProperties,\n} from '@countrystatecity/geojson';\n```\n\n## 📊 Data Source\n\nGenerated from the same underlying data as [`@countrystatecity/countries`](https://www.npmjs.com/package/@countrystatecity/countries), which sources from [countries-states-cities-database](https://github.com/dr5hn/countries-states-cities-database). Report data issues (wrong coordinates, missing entries) there.\n\n## 📄 License\n\nODbL-1.0\n","readmeFilename":"README.md"}