Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ismetcanbyk/turkey-location-data
Turkey province, district and neighborhood data.
https://github.com/ismetcanbyk/turkey-location-data
cities districts location-data neighborhood province turkey turkey-c turkey-location-data
Last synced: about 21 hours ago
JSON representation
Turkey province, district and neighborhood data.
- Host: GitHub
- URL: https://github.com/ismetcanbyk/turkey-location-data
- Owner: ismetcanbyk
- License: apache-2.0
- Created: 2024-07-28T10:17:03.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-07-29T16:35:35.000Z (3 months ago)
- Last Synced: 2024-10-01T00:53:15.390Z (about 1 month ago)
- Topics: cities, districts, location-data, neighborhood, province, turkey, turkey-c, turkey-location-data
- Language: TypeScript
- Homepage:
- Size: 501 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Turkey Location Data
#### With this package, you can access the most up-to-date list of provinces, districts and neighborhoods in Turkey.
### Installation
To install the package, use npm:
```bash
npm install turkey-location-data
```### Usage
Import the functions you need from the package:
```javascript
import {
getAllProvinces,
getDistrictsByProvinceApiId,
getNeighborhoodsByDistrictApiId,
getDistrictsByProvinceName,
} from "turkey-location-data";
```
### Methods
#### getAllProvinces
Fetches all provinces with their `apiId`:
```javascript
const provinces = getAllProvinces();
console.log(provinces);
```##### Response
```javascript
[
{ name: 'Adana', apiId: 23 },
{ name: 'Adıyaman', apiId: 24 },
{ name: 'Afyonkarahisar', apiId: 25 },
...
];
```
#### getDistrictsByProvinceApiId
Fetches districts based on the province's `apiId`:
```javascript
const districts = getDistrictsByProvinceApiId(23);
console.log(districts);
```##### Response
```javascript
[
{ name: 'Aladağ', apiId: 104 },
{ name: 'Ceyhan', apiId: 105 },
{ name: 'Çukurova', apiId: 6113 },
...
];
```
#### getNeighborhoodsByDistrictApiId
Fetches neighborhoods based on the district's `apiId`:
```javascript
const neighborhoods = getNeighborhoodsByDistrictApiId(104);
console.log(neighborhoods);
```##### Response
```javascript
[
'Akören', 'Akpınar', 'Başpınar',
'Boztahta', 'Büyüksofulu', 'Ceritler',
...
];
```
#### getDistrictsByProvinceName
Fetches districts based on the province's `name`:
```javascript
const districts = getDistrictsByProvinceName("Adana");
console.log(districts);
```##### Response
```javascript
[
{ name: 'Aladağ', apiId: 104 },
{ name: 'Ceyhan', apiId: 105 },
{ name: 'Çukurova', apiId: 6113 },
...
];
```
## Contact
### Feel free to contact me with any questions or suggestions.