Turkeylocation4j is a java module where you can get Turkey's city, district and neighborhood information.
The data used in this module is taken from the Turkish Cities project. I would like to thank Semih Arslanoğlu for allowing this data to be used.
Install with maven:
<dependency>
<groupId>io.github.burakpadr</groupId>
<artifactId>turkeylocation4j</artifactId>
<version>1.0.0</version>
</dependency>
-
City API
-
Find city from name
import io.github.burakpadr.turkeylocation4j.City; City.fromName("İstanbul").orElseThrow(NoSuchElementException::new); # => {name: İstanbul, latitude: 41.0082, ...} City.fromName("Istanbul").orElseThrow(NoSuchElementException::new); # => {name: İstanbul, latitude: 41.0082, ...} City.fromName("istanbul").orElseThrow(NoSuchElementException::new); # => {name: İstanbul, latitude: 41.0082, ...} City.fromName("ankara").orElseThrow(NoSuchElementException::new); # => {name: Ankara, latitude: 39.9334, ...}
-
Find city from plate number
import io.github.burakpadr.turkeylocation4j.City; City.fromPlateNumber(01).orElseThrow(NoSuchElementException::new); => # => {name: Adana, latitude: 35.3308, ...} City.fromPlateNumber(57).orElseThrow(NoSuchElementException::new); => # => {name: Sinop, latitude: 42.028, ...}
-
Find cities from region
import io.github.burakpadr.turkeylocation4j.City; import io.github.burakpadr.turkeylocation4j.Region; City.fromRegion(Region.EGE); # => [{name: Afyon, latitude: 38.7595, ...}, ...] City.fromRegion(Region.KARADENIZ); # => [{name: Amasya, latitude: 40.6565, ...}, ...]
-
Find cities that have sea access
import io.github.burakpadr.turkeylocation4j.City; City.fromHasSeaAccess(true); # => [{name: Adana, latitude: 35.3308, ...}, ...] City.fromHasSeaAccess(false); # => [{name: Adıyaman, latitude: 37.7636, ...}, ...]
-
Find all cities
import io.github.burakpadr.turkeylocation4j.City; City.fromNoFilter(); # => [{name: Adana, latitude: 35.3308, ...}, ...]
-
-
District API
- Find districts by city name
import io.github.burakpadr.turkeylocation4j.District; District.fromCityName("istanbul"); # => [{name: Adalar}, {name: Arnavutköy}, ...]
-
Neighborhood API
- Find neighborhoods by city name and district name
import io.github.burakpadr.turkeylocation4j.Neighborhood; Neighborhood.fromCityNameAndDistrictName("istanbul", "beşiktaş"); # => [{name: Abbasağa Mah, postCode: 34022}, ...]