-
Notifications
You must be signed in to change notification settings - Fork 3
feature/DF-680 location maps latlong, E&N and OSGR #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ps and postcode lookup plugins
…field base template
…n components on the page
| } | ||
|
|
||
| /** | ||
| * @param {MapConfiguration} options - the map options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to add a one-line description of what each of these handlers do as not totally obvious why they are needed
| function logErrorAndReturnEmpty(err, endpoint) { | ||
| const msg = `${getErrorMessage(err)} ${(Boom.isBoom(err) && err.data?.payload?.error?.message) ?? ''}` | ||
|
|
||
| logger.error(err, `Exception occured calling OS names ${endpoint} - ${msg}}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to log these as errors, or just info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are errors returned from OS api calls. They're unlikely to happen but if they do we should log as errors. This code matches the postcode lookup logging.
| */ | ||
| export async function find(query, apiKey) { | ||
| const endpoint = 'find' | ||
| const url = `https://api.os.uk/search/names/v1/find?key=${apiKey}&query=${query}&fq=local_type:postcode%20local_type:hamlet%20local_type:village%20local_type:town%20local_type:city%20local_type:other_settlement&maxresults=8` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the list of types likely to need changing? How did you determine what to include?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| */ | ||
| export async function nearest(easting, northing, apiKey) { | ||
| const endpoint = 'nearest' | ||
| const url = `https://api.os.uk/search/names/v1/nearest?key=${apiKey}&point=${easting},${northing}&radius=1000&fq=local_type:Airfield%20local_type:Airport%20local_type:Bus_Station%20local_type:Chemical_Works%20local_type:City%20local_type:Coach_Station%20local_type:Electricity_Distribution%20local_type:Electricity_Production%20local_type:Further_Education%20local_type:Gas_Distribution_or_Storage%20local_type:Hamlet%20local_type:Harbour%20local_type:Helicopter_Station%20local_type:Heliport%20local_type:Higher_or_University_Education%20local_type:Hill_Or_Mountain%20local_type:Hospice%20local_type:Hospital%20local_type:Medical_Care_Accommodation%20local_type:Named_Road%20local_type:Non_State_Primary_Education%20local_type:Non_State_Secondary_Education%20local_type:Other_Settlement%20local_type:Passenger_Ferry_Terminal%20local_type:Port_Consisting_of_Docks_and_Nautical_Berthing%20local_type:Postcode%20local_type:Primary_Education%20local_type:Railway_Station%20local_type:Road_User_Services%20local_type:Secondary_Education%20local_type:Section_Of_Named_Road%20local_type:Section_Of_Numbered_Road%20local_type:Special_Needs_Education%20local_type:Suburban_Area%20local_type:Town%20local_type:Urban_Greenspace%20local_type:Vehicular_Ferry_Terminal%20local_type:Vehicular_Rail_Terminal%20local_type:Village%20local_type:Waterfall%20` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, are the list of types likely to need changing? How did you determine what to include?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
jbarnsley10
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good. Just a couple of very minor comments, and a question or to for my benefit. Approving in principal.
* Add eastingnorthingfield to the list of supported location fields * Add easting northing capability to location maps * Remove unused osgrid * Add easting and northing tests location map client tests * Add map tests with initial field values
| VTS_OUTDOOR_URL: | ||
| 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main/OS_VTS_3857_Outdoor.json', | ||
| VTS_DARK_URL: | ||
| 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main/OS_VTS_3857_Dark.json', | ||
| VTS_BLACK_AND_WHITE_URL: | ||
| 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main/OS_VTS_3857_Black_and_White.json' | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should definitely pull these into our app, rather than hardcoding them to Ordnance Survey's github. Since this looks the main branch, if they restructure the repo/delete the files/etc it'll break our app.
I'd rather we downlod a copy and mirror them on our end, that way we can guarantee they'll always be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted this 9bae11a commit and will work on identifying any subsequent requests made to that domain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved with 09da972 and DEFRA/forms-runner@0941c6d
| thumbnail: `${assetPath}/defra-map/assets/images/outdoor-map-thumb.jpg`, | ||
| logo: `${assetPath}/defra-map/assets/images/os-logo.svg`, | ||
| logoAltText, | ||
| attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is missing from dark/black-white
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved with 5324874
| zoom: '16', | ||
| center, | ||
| markers: [ | ||
| { | ||
| id: 'location', | ||
| coords: center | ||
| } | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth pulling these (except center) into a constant and reusing them between the different inputs? so we don't get any drift between the individual component's maps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved with 88f2216 👍
| // Move the 'location' marker to the new point | ||
| map.addMarker('location', center) | ||
|
|
||
| // Pan & zoom the map to the new valid location | ||
| mapProvider.flyTo({ | ||
| center, | ||
| zoom: 14, | ||
| essential: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could pull this out into a centerMap(center) and share it between the component handlers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved with bd5918b
|
This is great stuff, Dave 🚀 Only one major comment really (styles), everything else is fairly trivial. |
…s e.g. sprites)" This reverts commit 9bae11a.
|



Proposed change
Add map capability to the LatLong location field using defra-map
Jira ticket: https://eaflood.atlassian.net/browse/DF-680
Type of change
Checklist
README.mdanddocs/*(where appropriate, e.g. new features).npm run test).npm run lint).npm run format).