maps4fs 1.8.221__py3-none-any.whl → 1.8.223__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
maps4fs/generator/map.py CHANGED
@@ -7,6 +7,8 @@ import os
7
7
  import shutil
8
8
  from typing import Any, Generator
9
9
 
10
+ from geopy.geocoders import Nominatim
11
+
10
12
  from maps4fs.generator.component import Background, Component, Layer, Texture
11
13
  from maps4fs.generator.dtm.dtm import DTMProvider, DTMProviderSettings
12
14
  from maps4fs.generator.game import Game
@@ -78,7 +80,9 @@ class Map:
78
80
  try:
79
81
  main_settings = {
80
82
  "game": game.code,
81
- "coordinates": coordinates,
83
+ "latitude": coordinates[0],
84
+ "longitude": coordinates[1],
85
+ "country": self.get_country_by_coordinates(),
82
86
  "size": size,
83
87
  "rotation": rotation,
84
88
  "dtm_provider": dtm_provider.name(),
@@ -327,3 +331,19 @@ class Map:
327
331
  except Exception as e:
328
332
  self.logger.debug("Error removing map directory %s: %s", self.map_directory, e)
329
333
  return archive_path
334
+
335
+ def get_country_by_coordinates(self) -> str:
336
+ """Get country name by coordinates.
337
+
338
+ Returns:
339
+ str: Country name.
340
+ """
341
+ try:
342
+ geolocator = Nominatim(user_agent="maps4fs")
343
+ location = geolocator.reverse(self.coordinates, language="en")
344
+ if location and "country" in location.raw["address"]:
345
+ return location.raw["address"]["country"]
346
+ except Exception as e:
347
+ self.logger.error("Error getting country name by coordinates: %s", e)
348
+ return "Unknown"
349
+ return "Unknown"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.221
3
+ Version: 1.8.223
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -3,7 +3,7 @@ maps4fs/logger.py,sha256=HQrDyj72mUjVYo25aR_-_SxVn2rfFjDCNbj-JKJdSnE,1488
3
3
  maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
4
  maps4fs/generator/dem.py,sha256=a9B3tatj7pzvvdLIyLw7BA3JoDTibFczpqiXJnx054U,12864
5
5
  maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,11292
6
- maps4fs/generator/map.py,sha256=D63BZGfC_D7AsloCPApv8rcnrEuffT2_XyUS6Tjj_zg,11838
6
+ maps4fs/generator/map.py,sha256=b_X8iVhvXgnSfcly6m8BhbFcWeG2HrSM4iAOylZRebE,12575
7
7
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
8
8
  maps4fs/generator/settings.py,sha256=d3NaMpyFh-IZWtHV2UQMMqUfuPP76lv7mIN2d7mORqA,6747
9
9
  maps4fs/generator/statistics.py,sha256=itae_EeAxxEMTpV_G3SsX6soUqDz8uGEFoit8GVrV5o,1621
@@ -53,8 +53,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
53
53
  maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
54
54
  maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
55
55
  maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
56
- maps4fs-1.8.221.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
57
- maps4fs-1.8.221.dist-info/METADATA,sha256=mKcyPDVMXiJWond1oRLdKSysUvETuZEwzkduzTmNAHw,45770
58
- maps4fs-1.8.221.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
59
- maps4fs-1.8.221.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
60
- maps4fs-1.8.221.dist-info/RECORD,,
56
+ maps4fs-1.8.223.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
57
+ maps4fs-1.8.223.dist-info/METADATA,sha256=sMyD1loEiJOWxG0POPaXJUnWGBcjkBzMgcQCAoCq4BE,45770
58
+ maps4fs-1.8.223.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
59
+ maps4fs-1.8.223.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
60
+ maps4fs-1.8.223.dist-info/RECORD,,