Comments (3)
After thinking about data structures for the city I think a graph could be a good idea. Here is an explanation of graph in python here : https://www.python-course.eu/graphs_python.php
I think we can start with a city like :
graph = { ["a", [0, 0], [0, 2]] : [["c", [0, 2], [2, 2]]],
["b", [1, 2], [3, 2]] : [["c", [0, 2], [2, 2]], ["d", [3, 2], [3, 6]]],
["c", [0, 2], [2, 2]] : [["a", [0, 0], [0, 2]], ["b", [1, 2], [3, 2]], ["d", [3, 2], [3, 6]]],
["d", [3, 2], [3, 6]] : [["c", [0, 2], [2, 2]]],
}
The data format is :
{
[node_name, [x_start, y_start], [x_end, y_end]]: [[node_name, [x_start, y_start], [x_end, y_end]], [node_name, [x_start, y_start], [x_end, y_end]]],
...
}
What do you think about it @Idruk ?
from smartcity.
node = [
name: "NodeName", type: "node_type",
XY_start: [x_start, y_start],
XY_end: [x_end, y_end],
walkable: bool, driveable: bool, bikeable: bool,
ImportantPlaces: [
place1, ..., placeX
]
]
I tough about a node like this, maybe there some more informations, you'd like to add in it ? @AurelienFT
EDIT :
node = [
name: "NodeName", type: "node_type",
XY_start: [x_start, y_start],
XY_end: [x_end, y_end],
walkable: bool, driveable: bool, bikeable: bool,
]
Looks better
from smartcity.
@Idruk I want to write informations about the nodes only one time so the file will look like that :
var ways = {
"nodes": [
{
"name": "a",
"type": "road",
"start": {
x: 0,
y: 0
},
"end": {
x: 0,
y: 10
},
"walkable": true,
"driveable": true,
"bikeable": true
},
{
"name": "b",
"type": "road",
"start": {
x: 0,
y: 5
},
"end": {
x: 5,
y: 5
},
"walkable": true,
"driveable": true,
"bikeable": true
},
{
"name": "c",
"type": "road",
"start": {
x: 0,
y: 8
},
"end": {
x: 5,
y: 8
},
"walkable": true,
"driveable": true,
"bikeable": true
},
{
"name": "d",
"type": "road",
"start": {
x: 5,
y: 0
},
"end": {
x: 5,
y: 8
},
"walkable": true,
"driveable": true,
"bikeable": true
}
],
"roads": [
{
"road": "a",
"neighbors": [
{"name": "b", "x": 0, "y": 5},
{"name": "c", "x": 0, "y": 8}
]
},
{
"road": "b",
"neighbors": [
{"name": "a", "x": 0, "y": 5},
{"name": "d", "x": 5, "y": 5}
]
},
{
"road": "c",
"neighbors": [
{"name": "a", "x": 0, "y": 8},
{"name": "d", "x": 5, "y": 8}
]
},
{
"road": "d",
"neighbors": [
{"name": "b", "x": 5, "y": 5},
{"name": "c", "x": 5, "y": 8}
]
}
]
}
from smartcity.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smartcity.