Skip to content

Commit

Permalink
Merge pull request #4957 from open-formulieren/bug/4955-registration-…
Browse files Browse the repository at this point in the history
…backend-geometry-data-format

Objects-api and zgw apis geometry coordinates data order
  • Loading branch information
sergei-maertens authored Dec 19, 2024
2 parents e11c687 + fbfc62f commit 082325c
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def process_mapped_variable(
assert isinstance(value, list) and len(value) == 2
value = {
"type": "Point",
"coordinates": [value[0], value[1]],
# Providing the coordinates as [lng, lat] #4955
"coordinates": [value[1], value[0]],
}

# not a component or standard behaviour where no transformation is necessary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
def _point_coordinate(value: Any) -> dict[str, Any] | object:
if not isinstance(value, list) or len(value) != 2:
return SKIP
return {"type": "Point", "coordinates": [value[0], value[1]]}
# Providing the coordinates as [lng, lat] #4955
return {"type": "Point", "coordinates": [value[1], value[0]]}


def _resolve_documenttype(
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ interactions:
- request:
body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b",
"bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form
032", "auteur": "Aanvrager", "taal": "nld", "formaat": "application/pdf", "inhoud":
"", "status": "definitief", "bestandsnaam": "open-forms-Form 032.pdf", "ontvangstdatum":
000", "auteur": "Aanvrager", "taal": "nld", "formaat": "application/pdf", "inhoud":
"", "status": "definitief", "bestandsnaam": "open-forms-Form 000.pdf", "ontvangstdatum":
null, "beschrijving": "Ingezonden formulier", "indicatieGebruiksrecht": false,
"bestandsomvang": 0}'
headers:
Expand All @@ -25,9 +25,9 @@ interactions:
uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten
response:
body:
string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0771aa11-61d6-4dfc-9935-bb7cd376c65f","identificatie":"DOCUMENT-2024-0000000045","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form
032","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"application/pdf","taal":"nld","versie":1,"beginRegistratie":"2024-11-26T10:28:52.594409Z","bestandsnaam":"open-forms-Form
032.pdf","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0771aa11-61d6-4dfc-9935-bb7cd376c65f/download?versie=1","bestandsomvang":0,"link":"","beschrijving":"Ingezonden
string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/ed5de000-7692-474a-b9e4-8dbded780e37","identificatie":"DOCUMENT-2024-0000000015","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form
000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"application/pdf","taal":"nld","versie":1,"beginRegistratie":"2024-12-19T10:06:16.789185Z","bestandsnaam":"open-forms-Form
000.pdf","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/ed5de000-7692-474a-b9e4-8dbded780e37/download?versie=1","bestandsomvang":0,"link":"","beschrijving":"Ingezonden
formulier","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}'
headers:
API-version:
Expand All @@ -41,7 +41,7 @@ interactions:
Cross-Origin-Opener-Policy:
- same-origin
Location:
- http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0771aa11-61d6-4dfc-9935-bb7cd376c65f
- http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/ed5de000-7692-474a-b9e4-8dbded780e37
Referrer-Policy:
- same-origin
Vary:
Expand All @@ -56,9 +56,9 @@ interactions:
- request:
body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3",
"bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form
032 (csv)", "auteur": "Aanvrager", "taal": "nld", "formaat": "text/csv", "inhoud":
"Rm9ybXVsaWVybmFhbSxJbnplbmRpbmdkYXR1bSxhZ2UsbGFzdG5hbWUsbG9jYXRpb24NCkZvcm0gMDMyLDIwMjQtMDMtMDMgMDk6MTQ6MDguMzI3MDkyLDIwLE15IGxhc3QgbmFtZSwiWzUyLjM2NjczMzc4OTY3MTIyLCA0Ljg5MzE2NDI3NDQ3MDI5OV0iDQo=",
"status": "definitief", "bestandsnaam": "open-forms-Form 032 (csv).csv", "ontvangstdatum":
000 (csv)", "auteur": "Aanvrager", "taal": "nld", "formaat": "text/csv", "inhoud":
"Rm9ybXVsaWVybmFhbSxJbnplbmRpbmdkYXR1bSxhZ2UsbGFzdG5hbWUsbG9jYXRpb24NCkZvcm0gMDAwLDIwMjQtMDMtMDEgMTk6MDk6MjUuNDA4MjU5LDIwLE15IGxhc3QgbmFtZSwiWzUyLjM2NjczMzc4OTY3MTIyLCA0Ljg5MzE2NDI3NDQ3MDI5OV0iDQo=",
"status": "definitief", "bestandsnaam": "open-forms-Form 000 (csv).csv", "ontvangstdatum":
null, "beschrijving": "Ingezonden formulierdata", "indicatieGebruiksrecht":
false, "bestandsomvang": 146}'
headers:
Expand All @@ -80,9 +80,9 @@ interactions:
uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten
response:
body:
string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/1d3564ce-f7d8-41a9-85de-8f4213676e83","identificatie":"DOCUMENT-2024-0000000046","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form
032 (csv)","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"text/csv","taal":"nld","versie":1,"beginRegistratie":"2024-11-26T10:28:52.673480Z","bestandsnaam":"open-forms-Form
032 (csv).csv","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/1d3564ce-f7d8-41a9-85de-8f4213676e83/download?versie=1","bestandsomvang":146,"link":"","beschrijving":"Ingezonden
string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7a1d75a4-8fd7-4945-b99d-05fadcd45e0b","identificatie":"DOCUMENT-2024-0000000016","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form
000 (csv)","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"text/csv","taal":"nld","versie":1,"beginRegistratie":"2024-12-19T10:06:16.925004Z","bestandsnaam":"open-forms-Form
000 (csv).csv","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7a1d75a4-8fd7-4945-b99d-05fadcd45e0b/download?versie=1","bestandsomvang":146,"link":"","beschrijving":"Ingezonden
formulierdata","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}'
headers:
API-version:
Expand All @@ -96,7 +96,7 @@ interactions:
Cross-Origin-Opener-Policy:
- same-origin
Location:
- http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/1d3564ce-f7d8-41a9-85de-8f4213676e83
- http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7a1d75a4-8fd7-4945-b99d-05fadcd45e0b
Referrer-Policy:
- same-origin
Vary:
Expand Down Expand Up @@ -125,24 +125,24 @@ interactions:
uri: http://localhost:8001/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48
response:
body:
string: '{"url":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","uuid":"8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","name":"Person","namePlural":"Persons","description":"","dataClassification":"open","maintainerOrganization":"","maintainerDepartment":"","contactPerson":"","contactEmail":"","source":"","updateFrequency":"unknown","providerOrganization":"","documentationUrl":"","labels":{},"createdAt":"2023-10-24","modifiedAt":"2024-02-08","allowGeometry":true,"versions":["http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48/versions/1","http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48/versions/2","http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48/versions/3"]}'
string: '{"url":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","uuid":"8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","name":"Person","namePlural":"Persons","description":"","dataClassification":"open","maintainerOrganization":"","maintainerDepartment":"","contactPerson":"","contactEmail":"","source":"","updateFrequency":"unknown","providerOrganization":"","documentationUrl":"","labels":{},"createdAt":"2023-10-24","modifiedAt":"2024-11-25","allowGeometry":true,"versions":["http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48/versions/1","http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48/versions/2","http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48/versions/3","http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48/versions/4"]}'
headers:
Allow:
- GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Connection:
- keep-alive
Content-Length:
- '790'
- '887'
Content-Type:
- application/json
Cross-Origin-Opener-Policy:
- same-origin
Date:
- Tue, 26 Nov 2024 10:28:52 GMT
- Thu, 19 Dec 2024 10:06:17 GMT
Referrer-Policy:
- same-origin
Server:
- nginx/1.27.0
- nginx/1.27.3
Vary:
- origin
X-Content-Type-Options:
Expand All @@ -156,11 +156,11 @@ interactions:
body: '{"type": "http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48",
"record": {"typeVersion": 3, "data": {"age": 20, "name": {"last.name": "My last
name"}, "submission_date": "2024-03-19T13:40:00+00:00", "submission_pdf_url":
"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0771aa11-61d6-4dfc-9935-bb7cd376c65f",
"submission_csv_url": "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/1d3564ce-f7d8-41a9-85de-8f4213676e83",
"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/ed5de000-7692-474a-b9e4-8dbded780e37",
"submission_csv_url": "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7a1d75a4-8fd7-4945-b99d-05fadcd45e0b",
"submission_payment_completed": false, "submission_payment_amount": null, "submission_payment_public_ids":
[], "cosign_date": null}, "startAt": "2024-03-19", "geometry": {"type": "Point",
"coordinates": [52.36673378967122, 4.893164274470299]}}}'
"coordinates": [4.893164274470299, 52.36673378967122]}}}'
headers:
Accept:
- '*/*'
Expand All @@ -182,8 +182,8 @@ interactions:
uri: http://localhost:8002/api/v2/objects
response:
body:
string: '{"url":"http://objects-web:8000/api/v2/objects/09953ea1-d03e-4cde-93d3-87a416e6cb48","uuid":"09953ea1-d03e-4cde-93d3-87a416e6cb48","type":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","record":{"index":1,"typeVersion":3,"data":{"age":20,"name":{"last.name":"My
last name"},"submission_date":"2024-03-19T13:40:00+00:00","submission_pdf_url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0771aa11-61d6-4dfc-9935-bb7cd376c65f","submission_csv_url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/1d3564ce-f7d8-41a9-85de-8f4213676e83","submission_payment_completed":false,"submission_payment_amount":null,"submission_payment_public_ids":[],"cosign_date":null},"geometry":{"type":"Point","coordinates":[52.36673378967122,4.893164274470299]},"startAt":"2024-03-19","endAt":null,"registrationAt":"2024-11-26","correctionFor":null,"correctedBy":null}}'
string: '{"url":"http://objects-web:8000/api/v2/objects/a73b1bd4-91c0-444b-9241-93b111f83681","uuid":"a73b1bd4-91c0-444b-9241-93b111f83681","type":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","record":{"index":1,"typeVersion":3,"data":{"age":20,"name":{"last.name":"My
last name"},"submission_date":"2024-03-19T13:40:00+00:00","submission_pdf_url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/ed5de000-7692-474a-b9e4-8dbded780e37","submission_csv_url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7a1d75a4-8fd7-4945-b99d-05fadcd45e0b","submission_payment_completed":false,"submission_payment_amount":null,"submission_payment_public_ids":[],"cosign_date":null},"geometry":{"type":"Point","coordinates":[4.893164274470299,52.36673378967122]},"startAt":"2024-03-19","endAt":null,"registrationAt":"2024-12-19","correctionFor":null,"correctedBy":null}}'
headers:
Allow:
- GET, POST, HEAD, OPTIONS
Expand All @@ -198,13 +198,13 @@ interactions:
Cross-Origin-Opener-Policy:
- same-origin
Date:
- Tue, 26 Nov 2024 10:28:52 GMT
- Thu, 19 Dec 2024 10:06:17 GMT
Location:
- http://localhost:8002/api/v2/objects/09953ea1-d03e-4cde-93d3-87a416e6cb48
- http://localhost:8002/api/v2/objects/a73b1bd4-91c0-444b-9241-93b111f83681
Referrer-Policy:
- same-origin
Server:
- nginx/1.27.0
- nginx/1.27.3
Vary:
- origin
X-Content-Type-Options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def test_submission_with_objects_api_v2(self):
result["record"]["geometry"],
{
"type": "Point",
"coordinates": [52.36673378967122, 4.893164274470299],
"coordinates": [4.893164274470299, 52.36673378967122],
},
)

Expand Down Expand Up @@ -575,7 +575,7 @@ def test_submission_with_map_component_inside_data(self):
data["pointCoordinates"],
{
"type": "Point",
"coordinates": [52.36673378967122, 4.893164274470299],
"coordinates": [4.893164274470299, 52.36673378967122],
},
)

Expand Down
3 changes: 2 additions & 1 deletion src/openforms/registrations/contrib/zgw_apis/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def get_property_mappings_from_submission(
def _point_coordinate(value):
if not value or not isinstance(value, list) or len(value) != 2:
return SKIP
return {"type": "Point", "coordinates": [value[0], value[1]]}
# Providing the coordinates as [lng, lat] #4955
return {"type": "Point", "coordinates": [value[1], value[0]]}


def _gender_choices(value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def test_submission_with_zgw_backend_with_natuurlijk_persoon_initiator(self, m):
create_zaak_body["zaakgeometrie"],
{
"type": "Point",
"coordinates": [52.36673378967122, 4.893164274470299],
"coordinates": [4.893164274470299, 52.36673378967122],
},
)

Expand Down Expand Up @@ -538,7 +538,7 @@ def test_submission_with_zgw_backend_with_vestiging_and_kvk_initiator(self, m):
create_zaak_body["zaakgeometrie"],
{
"type": "Point",
"coordinates": [52.36673378967122, 4.893164274470299],
"coordinates": [4.893164274470299, 52.36673378967122],
},
)

Expand Down Expand Up @@ -833,7 +833,7 @@ def test_submission_with_zgw_backend_with_vestiging_initiator_kvk_only(self, m):
create_zaak_body["zaakgeometrie"],
{
"type": "Point",
"coordinates": [52.36673378967122, 4.893164274470299],
"coordinates": [4.893164274470299, 52.36673378967122],
},
)

Expand Down Expand Up @@ -1885,7 +1885,7 @@ def get_create_json_for_zaakobject(req, ctx):
"startAt": date.today().isoformat(),
"geometry": {
"type": "Point",
"coordinates": [52.36673378967122, 4.893164274470299],
"coordinates": [4.893164274470299, 52.36673378967122],
},
"endAt": None,
"registrationAt": date.today().isoformat(),
Expand Down

0 comments on commit 082325c

Please sign in to comment.