如何将 shapefile 插入 MySQL 数据库?
我正在尝试找到这个 shp2mysql
工具。但我发现的只是 PHP 实现。网上还有其他版本吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我正在尝试找到这个 shp2mysql
工具。但我发现的只是 PHP 实现。网上还有其他版本吗?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
我找到了解决方案 下载。 (Windows版本)
自述文件说它需要Cygwin,但我刚刚执行它并且它起作用了。
I found a solution for download. (Windows version)
The readme says it needs Cygwin, but I just executed it and it worked.
我不确定您是否想要将文件插入数据库,但如果您必须这样做,我不明白为什么您不能使用 MySQL 的 BINARY 或 BLOB 数据类型(我不记得 .shp 文件是否是二进制或文本)。只需使用 [插入您最喜欢的语言] 读取文件并构造适当的 MySQL 查询语句以将其添加到数据库中 - 这非常简单,几乎微不足道。
更好的解决方案是将文件存储在文件系统中,并在数据库中记录该文件的路径,以便您在需要时打开该文件并读取它。
I'm not sure you would want to insert files into a database, but if you had to, I don't see why you can't use MySQL's BINARY or BLOB data type (I can't recall if a .shp file is binary or text). Just read in the file using [insert your favorite language] and construct the appropriate MySQL query statement to add it to the database - it's pretty easy, almost trivial.
A better solution would be to store the file in your file system and record a path to it in your database, allowing you to open the file and read it when needed.