-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Team Settings Form Fetching Boundary GeoJSON using Boundary URL #3378
Conversation
Removed vultr server and associated DNS entries |
🤖 Hasura Change Summary compared a subset of table metadata including permissions: Updated Tables (1)
|
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.
A few small comments!
I'll pick up the changes and add them as commits to this branch, but still wanted to follow through the feedback process so you can see the changes made here when you're back 👍
editor.planx.uk/package.json
Outdated
@@ -38,6 +38,7 @@ | |||
"@turf/area": "^7.0.0", | |||
"@turf/buffer": "^6.5.0", | |||
"@turf/helpers": "^6.5.0", | |||
"@turf/turf": "^7.0.0", |
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 think we should just import the functions we need rather than the entire package.
Take a look at the difference between https://bundlephobia.com/package/@turf/[email protected] & https://bundlephobia.com/package/@turf/[email protected]
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.
Fixed in c4f1e3d
} catch (error) { | ||
formik.errors.boundaryUrl = | ||
"We are unable to retrieve your boundary, check your boundary URL and try again"; | ||
console.error(error); |
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 looks good!
We might want slightly more fine-grained checking of the error type (i.e. using isAxiosError()
) or a bit more control over the URL we send the request to.
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.
package.json
Outdated
}, | ||
"dependencies": { | ||
"@types/geojson": "^7946.0.14" |
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 looks like an npm i
at the wrong level
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.
Fixed by c410ab5
@@ -9,10 +11,16 @@ import { SettingsForm } from "../shared/SettingsForm"; | |||
import { FormProps } from "."; | |||
|
|||
export default function BoundaryForm({ formikConfig, onSuccess }: FormProps) { | |||
const suffixRegEx = /\d{1,10}$/; |
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 a good approach 👍
We might actually want to restrict the domain as well (e.g. we don't want to allow users to make a request to https://something-dodgy.com/123456
). I'll check with @ianjon3s but I think an an input prefix here is likely the best way forward.
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.
Fixed here - 21cfa53
For now I've not added an prefix - I think just copy/pasting the full URL is likely an easier user interaction than grabbing the entity ID.
c410ab5
to
bba77f5
Compare
bba77f5
to
b0cf22a
Compare
c1db3f2
to
21cfa53
Compare
const bboxPoly = bboxPolygon(bbox(data)); | ||
const bboxFeature = feature(bboxPoly.geometry); |
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'm not quite sure if this is the simplest way to achieve this. If we add types and maybe wrap this in a descriptive helper function it may help clear this up.
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.
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.
Changes work for me here !
What does this PR do?
This PR uses the
boundary_url
provided by users to generate the boundary GeoJSON from https://www.planning.data.gov.uk/ API - using the entity number is the guide.The returned GeoJSON is then passed through turf.js to output a boundary box geoJSON, a simplified geoJSON object, that is stored in the
team_settings
table