-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from laem/rev
Visualisation des réseaux structurants
- Loading branch information
Showing
49 changed files
with
2,878 additions
and
498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ dist/ | |
.env | ||
.next/ | ||
web/.next/ | ||
web/.env.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import point from 'turf-point' | ||
import distance from '@turf/distance' | ||
|
||
export default function (coordinates) { | ||
const result = coordinates.reduce( | ||
(memo, next) => { | ||
if (!memo.lastPoint) return { total: 0, lastPoint: next } | ||
const newDistance = distanceBetweenPoints(memo.lastPoint, next) | ||
|
||
return { total: memo.total + newDistance, lastPoint: next } | ||
}, | ||
{ total: 0, lastPoint: null } | ||
) | ||
return result.total | ||
} | ||
|
||
const distanceBetweenPoints = (latLng, latLng2) => { | ||
var from = point(latLng) | ||
var to = point(latLng2) | ||
|
||
return distance(from, to) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import isSafePath from './isSafePath' | ||
import lineStringDistance from './lineStringDistance' | ||
|
||
export default function (segments, safeExtension) { | ||
const { safe, unsafe } = segments.reduce( | ||
(memo, next) => { | ||
const coordinates = next.geometry.coordinates | ||
const segmentDistance = lineStringDistance(coordinates) | ||
const distance = segmentDistance * (next.properties.rides?.length || 0) | ||
const safe = | ||
isSafePath(next.properties.tags) || | ||
(safeExtension && safeExtension(next.properties.tags)) | ||
if (!safeExtension && safe !== next.properties.isSafePath) | ||
return new Error( | ||
"Le serveur et le client ne sont pas d'accord sur le caractère sécurisé du segment" | ||
) | ||
|
||
return { | ||
safe: memo.safe + (safe ? distance : 0), | ||
unsafe: memo.unsafe + (safe ? 0 : distance), | ||
} | ||
}, | ||
{ safe: 0, unsafe: 0 } | ||
) | ||
|
||
return (safe / (safe + unsafe)) * 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
const url = `https://api.villes.plus/` | ||
//const url = `http://localhost:3000/` | ||
const url = process.env.NEXT_PUBLIC_API_URL || `https://api.villes.plus/` | ||
|
||
export default url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
abeb007
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.
Successfully deployed to the following URLs:
villes-plus – ./
villes-plus-git-master-menoz.vercel.app
villes.plus
villes-plus-menoz.vercel.app
villes-plus.vercel.app
www.villes.plus