-
Notifications
You must be signed in to change notification settings - Fork 4
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
Drag n drop des fichiers geojson en projection 2154 #1001
Conversation
@@ -66,3 +74,30 @@ const FileDragNDrop = () => { | |||
}; | |||
|
|||
export default FileDragNDrop; | |||
|
|||
const isLambert93Projection = (geojson: any) => geojson.crs?.properties?.name && geojson.crs.properties.name.includes('2154'); |
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.
Je mettrai bien ca dans un utils/geo
car c'est pas vraiment spécifique au drag n drop
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.
Ben je suis vraiment pas sûr qu'on utilise ça ailleurs de sitôt. Tu parles juste de isLambert93Projection ou des autres fonctions de conversion aussi ?
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.
Comme discuté => mis dans utils/geo
}; | ||
|
||
const convertGeoJSON = (geojson: any): any => { | ||
if (isLambert93Projection(geojson)) { |
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.
early exit please
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.
C'est surtout valable quand y'a un else return je trouve. Et sinon ça voudrait dire qu'il faut inverser la condition. Donc pour pas grand chose.
=> j'ai refactor un peu pour gérer le if en dehors et donc cette fonction ne fait plus que convertir le geojson.
return proj4(from, to, coords); | ||
}; | ||
|
||
const convertGeoJSON = (geojson: any): any => { |
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.
convert to what?
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.
convertLambert93GeoJSONToWGS84 😂 J'ai ajouté des commentaires aussi. L'idée est d'obtenir un geojson en WGS 84. J'ai refactoré aussi un peu cf autre commentaire.
@@ -66,3 +74,30 @@ const FileDragNDrop = () => { | |||
}; | |||
|
|||
export default FileDragNDrop; |
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 dynamic pour bénéficier du code splitting
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.
J'ai fait un import dynamique 👍
Le code JS est uniquement chargé quand on fait le drag n drop maintenant.
d79d00b
to
4830b43
Compare
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.
👏👏👏
Permet de drag n drop des fichiers geojson en projection 2154 sur la carte. Ca sera utile pour vérifier que les fichiers des réseaux sont au bon format. (cf trello)
Sachant qu'il n'existe pas d'outils web pour visualiser ça facilement.