faker.providers.geo
¶
-
class
faker.providers.geo.
Provider
(generator)¶ Bases:
faker.providers.BaseProvider
land_coords data extracted from geonames.org, under the Creative Commons Attribution 3.0 License. Coordinates are in decimal format for mapping purposes. Country code is in Alpha 2 format (https://www.nationsonline.org/oneworld/country_code_list.htm). Timezones are canonical (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
-
coordinate
(center=None, radius=0.001)¶ Optionally center the coord and pick a point within radius.
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.coordinate() ... 26.826999 45.792650 -158.265114 -40.995129 94.488524
-
latitude
()¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.latitude() ... 13.4134995 22.896325 -79.132557 -20.4975645 47.244262
-
latlng
()¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.latlng() ... (Decimal('13.4134995'), Decimal('45.792650')) (Decimal('-79.132557'), Decimal('-40.995129')) (Decimal('47.244262'), Decimal('80.880444')) (Decimal('18.6986795'), Decimal('-17.160223')) (Decimal('37.935520'), Decimal('12.226293'))
-
local_latlng
(country_code='US', coords_only=False)¶ Returns a location known to exist on land in a country specified by country_code. Defaults to ‘en_US’. See the land_coords list for available locations/countries.
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.local_latlng() ... ('34.95303', '-120.43572', 'Santa Maria', 'US', 'America/Los_Angeles') ('34.09668', '-117.71978', 'Claremont', 'US', 'America/Los_Angeles') ('42.16808', '-88.42814', 'Huntley', 'US', 'America/Chicago') ('39.96097', '-75.60804', 'West Chester', 'US', 'America/New_York') ('46.09273', '-88.64235', 'Iron River', 'US', 'America/Menominee')
-
location_on_land
(coords_only=False)¶ Returns a random tuple specifying a coordinate set guaranteed to exist on land. Format is (latitude, longitude, place name, two-letter country code, timezone) Pass coords_only to return coordinates without metadata.
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.location_on_land() ... ('38.70734', '-77.02303', 'Fort Washington', 'US', 'America/New_York') ('34.5624', '38.28402', 'Tadmur', 'SY', 'Asia/Damascus') ('30.21121', '74.4818', 'Malaut', 'IN', 'Asia/Kolkata') ('38.10558', '-1.86343', 'Caravaca', 'ES', 'Europe/Madrid') ('35', '136.51667', 'Komono', 'JP', 'Asia/Tokyo')
-
longitude
()¶ Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.longitude() ... 26.826999 45.792650 -158.265114 -40.995129 94.488524
-