mysql - 此路线图的数据库设计

标签 mysql oracle google-maps database-design uml

我正在考虑路线图的数据库模式并考虑最佳模型。我脑子里有以下需要解决的问题

Do streets s1 and s2 intersect?
Get all streets adjacent to point of interest p.

OR 

Get the distance between entrance e1 and exit e2 on highway h.
Get the shortest route from intersection i1 to intersection i2.

我认为表名应该

roads and streets, including highways
governmental regions: states, counties, and local municipalities of cities, towns, villages

我在数据库建模方面有很强的专业知识,但这是我第一次创建这样的模式,这方面的任何帮助

根据 SO 规则,OP 必须付出一些努力,我看到了一些 similar questions这就是为什么我在架构方面寻求帮助。

最佳答案

  • 您需要有节点和边 - 用于内部解决您的任务。 (捷径等)
  • 您需要将您所讲述的道路、街道和地区从您的内在模型转化为人类语言。另外,不要忘记点对象:公共(public)汽车站、十字路口、房屋入口、电话亭、商店等。
  • 因此,您需要两个模型和一个结构以及一组用于在它们之间进行转换的方法。

内部模型:

Table: NODE           Table: EDGE
Id                    Id
place(REGION.Id)      Start(Node.Id)
                      End (Node.Id)
                      Length
                      road (ROAD.Id) (to what road belongs)

外部模型:

Table: ROAD           Table: Crossroad              Table:REGION
Id                    point (NODE.Id)               Id
Level                 Id                            Name  
Name                                                Level
                                                    Parent (REGION.Id)

关于mysql - 此路线图的数据库设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22316711/

相关文章:

mysql - 让 Twitter Bootstrap slider 高效地从 MySQL 加载长图片列表

javascript - 如何防止数字数据的SQL注入(inject)

PHP查询mysql数据库,echo长名称换取短表值

oracle - 使用 Spark 查询 Oracle DB 时出现 "ORA-00933: SQL command not properly ended"错误

php - Oracle 11g DB 返回流而不是字符串

php - 试图从 MYSQL 数据库打印出我的所有记录,但只显示 1 条记录

sql - 获取列中允许的最大长度 |甲骨文

google-maps - 适合 Google map 的图书馆吗?

javascript - 如何使该脚本可读

reactjs - 标记不适用于 google-map-react