diff --git a/inspire_schemas/builders/conferences.py b/inspire_schemas/builders/conferences.py index ea54becb..e20530e5 100644 --- a/inspire_schemas/builders/conferences.py +++ b/inspire_schemas/builders/conferences.py @@ -85,8 +85,7 @@ def add_address( self, cities=None, country_code=None, - latitude=None, - longitude=None, + coordinates=None, place_name=None, postal_address=None, postal_code=None, @@ -97,8 +96,7 @@ def add_address( Args: cities (list): list of strings containing cities. country_code (str): string of length 2 representing the country. - latitude (float): latitude of the location. - longitude (float): longitude of the location. + coordinates (dict(lon, lat)): a dict of coordinates for loaction place_name (str): name of the specific place where this is located. postal_address (str): full postal address in original language. postal_code (str): postal code of the location. @@ -108,8 +106,7 @@ def add_address( 'addresses', cities=cities, country_code=country_code, - latitude=latitude, - longitude=longitude, + coordinates=coordinates, place_name=place_name, postal_address=postal_address, postal_code=postal_code, diff --git a/inspire_schemas/builders/seminars.py b/inspire_schemas/builders/seminars.py index b78cba71..969216bd 100644 --- a/inspire_schemas/builders/seminars.py +++ b/inspire_schemas/builders/seminars.py @@ -67,8 +67,7 @@ def set_address( self, cities=None, country_code=None, - latitude=None, - longitude=None, + coordinates=None, place_name=None, postal_address=None, postal_code=None, @@ -78,8 +77,7 @@ def set_address( Args: cities (list): list of strings containing cities. country_code (str): string of length 2 representing the country. - latitude (float): latitude of the location. - longitude (float): longitude of the location. + coordinates (dict(lon, lat)): coordinates of the loaction. place_name (str): name of the specific place where this is located. postal_address (str): full postal address in original language. postal_code (str): postal code of the location. @@ -91,10 +89,8 @@ def set_address( address['cities'] = cities if country_code: address['country_code'] = country_code - if latitude: - address['latitude'] = latitude - if longitude: - address['longitude'] = longitude + if coordinates: + address['coordinates'] = coordinates if place_name: address['place_name'] = place_name if postal_address: diff --git a/inspire_schemas/records/elements/address.yml b/inspire_schemas/records/elements/address.yml index 23f544e8..5b07a7b6 100644 --- a/inspire_schemas/records/elements/address.yml +++ b/inspire_schemas/records/elements/address.yml @@ -23,16 +23,8 @@ properties: uniqueItems: true country_code: $ref: country_code.json - latitude: - description: |- - :example: 50.7736 - title: Latitude of the location - type: number - longitude: - description: |- - :example: 6.07532 - title: Longitude of the location - type: number + coordinates: + $ref: coordinates.json place_name: description: |- Name of the specific place where this is located. diff --git a/inspire_schemas/records/elements/coordinates.yml b/inspire_schemas/records/elements/coordinates.yml new file mode 100644 index 00000000..ce52b1ed --- /dev/null +++ b/inspire_schemas/records/elements/coordinates.yml @@ -0,0 +1,12 @@ +additionalProperties: true +description: |- + Coordinates of the location +properties: + lon: + title: Longitude of the location + type: number + lat: + title: Latitude of the location + type: number +title: Coordinates of the location +type: object \ No newline at end of file diff --git a/tests/integration/fixtures/conferences_example.json b/tests/integration/fixtures/conferences_example.json index 800ee9ab..c30ff562 100644 --- a/tests/integration/fixtures/conferences_example.json +++ b/tests/integration/fixtures/conferences_example.json @@ -32,8 +32,10 @@ "sed sint ut" ], "country_code": "HN", - "latitude": 98176984, - "longitude": -89125791, + "coordinates": { + "lon": 98176984, + "lat": -89125791 + }, "place_name": "qui anim", "postal_address": [ "qui", diff --git a/tests/integration/fixtures/institutions_example.json b/tests/integration/fixtures/institutions_example.json index b97fb224..cea6adc7 100644 --- a/tests/integration/fixtures/institutions_example.json +++ b/tests/integration/fixtures/institutions_example.json @@ -20,8 +20,10 @@ "nisi deserunt eu cupidatat" ], "country_code": "CF", - "latitude": 96958276, - "longitude": 58308717, + "coordinates": { + "lon": 96958276, + "lat": 58308717 + }, "place_name": "anim nulla in", "postal_address": [ "pariatur id sint irure in", @@ -35,8 +37,6 @@ "consectetur nulla quis" ], "country_code": "IS", - "latitude": -14558297, - "longitude": 55541699, "place_name": "labore", "postal_address": [ "sed laborum enim elit", @@ -54,8 +54,10 @@ "ipsum" ], "country_code": "KZ", - "latitude": 65627536, - "longitude": -93715142, + "coordinates": { + "lon": 65627536, + "lat": -93715142 + }, "place_name": "tempor", "postal_address": [ "ani", @@ -70,8 +72,10 @@ "in labore sed labo" ], "country_code": "NU", - "latitude": 80630464, - "longitude": -58695324, + "coordinates": { + "lon": 80630464, + "lat": -58695324 + }, "place_name": "cillum cupidatat sed Lorem in", "postal_address": [ "sed rep", @@ -91,8 +95,10 @@ "velit quis pariatur" ], "country_code": "MN", - "latitude": -76869123, - "longitude": 66796700, + "coordinates": { + "lon": -76869123, + "lat": 66796700 + }, "place_name": "cupidatat", "postal_address": [ "nostrud adipisicing sint Duis", diff --git a/tests/integration/fixtures/seminars_example.json b/tests/integration/fixtures/seminars_example.json index 24f2a02c..03edc59d 100644 --- a/tests/integration/fixtures/seminars_example.json +++ b/tests/integration/fixtures/seminars_example.json @@ -32,8 +32,10 @@ "mollit magna" ], "country_code": "DK", - "latitude": 42002729, - "longitude": -69156711, + "coordinates": { + "lon": 42002729, + "lat": -69156711 + }, "place_name": "et tempor Lorem mollit esse", "postal_address": [ "nisi consectetur eu",