diff --git a/gramps/plugins/webreport/basepage.py b/gramps/plugins/webreport/basepage.py index e37673a7b..8d7fc5b08 100644 --- a/gramps/plugins/webreport/basepage.py +++ b/gramps/plugins/webreport/basepage.py @@ -2878,6 +2878,16 @@ class BasePage: tbody += trow data = place.get_latitude() + v_lat, v_lon = conv_lat_lon(data, "0.0", "D.D8") + if not v_lat: + data += self._(":") + # We use the same message as in: + # gramps/gui/editors/editplace.py + # gramps/gui/editors/editplaceref.py + data += self._("Invalid latitude\n(syntax: 18\\u00b09'48.21\"S," + " -18.2412 or -18:9:48.21)") + # We need to convert "\\u00b0" to "°" for html + data = data.replace("\\u00b0", "°") if data != "": trow = Html('tr') + ( Html("td", self._("Latitude"), class_="ColumnAttribute", @@ -2886,6 +2896,16 @@ class BasePage: ) tbody += trow data = place.get_longitude() + v_lat, v_lon = conv_lat_lon("0.0", data, "D.D8") + if not v_lon: + data += self._(":") + # We use the same message as in: + # gramps/gui/editors/editplace.py + # gramps/gui/editors/editplaceref.py + data += self._("Invalid longitude\n(syntax: 18\\u00b09'48.21\"E," + " -18.2412 or -18:9:48.21)") + # We need to convert "\\u00b0" to "°" for html + data = data.replace("\\u00b0", "°") if data != "": trow = Html('tr') + ( Html("td", self._("Longitude"), class_="ColumnAttribute", diff --git a/gramps/plugins/webreport/place.py b/gramps/plugins/webreport/place.py index dada44daa..2b8adca2b 100644 --- a/gramps/plugins/webreport/place.py +++ b/gramps/plugins/webreport/place.py @@ -495,11 +495,14 @@ class PlacePages(BasePage): # Begin inline javascript code because jsc is a # docstring, it does NOT have to be properly indented + latitude, longitude = conv_lat_lon(place.get_latitude(), + place.get_longitude(), + "D.D8") + if not (latitude and longitude): + # We have incorrect longitude and/or latitude for this place. + latitude = longitude = 0.0 if self.placemappages: if place and (place.lat and place.long): - latitude, longitude = conv_lat_lon(place.get_latitude(), - place.get_longitude(), - "D.D8") tracelife = " " if self.create_media and media_list: for fmedia in media_list: