Merge pull request #1290 from SNoiraud/B12374

This commit is contained in:
Nick Hall 2022-01-28 21:49:56 +00:00
commit 2ada529a21
2 changed files with 34 additions and 8 deletions

View File

@ -186,14 +186,40 @@ class EditPlace(EditPrimary):
self.db.readonly) self.db.readonly)
def set_latlongitude(self, value): def set_latlongitude(self, value):
"""
This method is useful for directly copying the coordinates
of openstreetmap, googlemaps, and perhaps other if they
provide coordinates like it is define in conv_lat_lon
(see gramps/gen/utils/place.py)
To copy the coordinates:
- openstreetmap:
1 - choose the place where you want to save the coordinates.
2 - right click on this place
3 - select "show address"
4 - On the left side of the map, copy the coordinates of
"Result from internal"
5 - In the latlon field of the edit place window of gramps,
type <CTRL> V
- googlemap:
1 - choose the place where you want to save the coordinates.
2 - right click on this place
3 - select the coordinates at the top of the popup window.
They are automaticaly copied.
4 - In the latlon field of the edit place window of gramps,
type <CTRL> V
"""
try: try:
# Bug 12349 # Bug 12349, 12374
parts = value.split(', ') parts = value.split(', ')
if len(parts) == 2: if len(parts) == 2:
longitude = parts[0].strip().replace(',', '.') latitude = parts[0].strip().replace(',', '.')
latitude = parts[1].strip().replace(',', '.') longitude = parts[1].strip().replace(',', '.')
else: else:
longitude, latitude = value.split(',') latitude, longitude = value.split(',')
self.longitude.set_text(longitude) self.longitude.set_text(longitude)
self.latitude.set_text(latitude) self.latitude.set_text(latitude)

View File

@ -180,13 +180,13 @@ class EditPlaceRef(EditReference):
def set_latlongitude(self, value): def set_latlongitude(self, value):
try: try:
# Bug 12349 # Bug 12349, 12374
parts = value.split(', ') parts = value.split(', ')
if len(parts) == 2: if len(parts) == 2:
longitude = parts[0].strip().replace(',', '.') latitude = parts[0].strip().replace(',', '.')
latitude = parts[1].strip().replace(',', '.') longitude = parts[1].strip().replace(',', '.')
else: else:
longitude, latitude = value.split(',') latitude, longitude = value.split(',')
self.longitude.set_text(longitude) self.longitude.set_text(longitude)
self.latitude.set_text(latitude) self.latitude.set_text(latitude)