如何在php中添加形状文件(.shp)并在php文件中使用该形状文件数据? [英] How can I add shape file (.shp) in php and use that shape file data in php file?

查看:215
本文介绍了如何在php中添加形状文件(.shp)并在php文件中使用该形状文件数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须用php开发一个项目,其中必须包含shape文件,并且该shape文件需要转换为kml文件.

I have to develop one project in php and in that I have to include shape file and that shape file needs to be converted in to kml file.

我知道如何将形状文件转换为kml文件,但是我不知道如何将形状文件导入/导入php项目.
而且我还有形状文件的支持文件,其中包含更多信息.其中一些是.dbf,.shx等.所有这些文件的信息也应与形状文件信息一起存储.

I know how to convert shape file into kml file but I don't know how to take/import shape file into php project.
and I also have the supporting files with the shape file which contain more information.some of them are .dbf, .shx etc. And this all file's information should also be stored with the shape file information.

是否有导入形状文件或任何其他帮助的工具,以便可以将形状文件添加到php站点的项目中? 还是可以存储所有形状文件(.shp)、. dbf 、.将数据shx到数据库中,然后将其用于kml结构.

Is there any tool to import shape file or any other help so that I can add shape file into my project in php site? or is it possible to store all the shape file(.shp), .dbf, . shx data into database and then use that data for the kml structuring.

我还想知道,所有形状文件都遵循任何结构或格式吗?该形状文件是否有任何标准? 如xml文件有?

I also want to know that,all shape files follow any structure or formatting?Is there any standard for the shape file such as the xml file have?

xml文件应具有必需的开始标记.
他们应该遵循以下结构,否则查看者将看不到xml文件.

xml file should have the starting tag mandatory.
They should follow the structure otherwise the viewer is unable to see the xml file.

推荐答案

更新2:
对于 v3.0.0 版本,该库已被完全重写使用面向对象的方法:现在,它公开了一些方便的 ShapefileReader ShapefileWriter 和各种 Geometry 对象( Point MultiPoint 线串 MultiLinestring 多边形 MultiPolygon ).
已添加了对自定义字符集( CPG 文件),备注字段( DBT 文件)的支持,最重要的是,它现在能够编写shapefile
目前,它旨在成为最完善的免费开放源代码PHP库,以在那里读取和写入shapefile,并且在最近几年中它已被许多用户广泛使用,但应该如果发现有任何错误,请报告并/或打开一个问题,该问题将立即得到解决.

UPDATE 2:
For v3.0.0 release, the library has been completely rewritten with an object-oriented approach: it now exposes some convenient ShapefileReader, ShapefileWriter and different kinds of Geometry objects (Point, MultiPoint, Linestring, MultiLinestring, Polygon and MultiPolygon).
It has been added support for custom charsets (CPG files), memo fields (DBT files) and, most importantly, it is now able to write shapefiles too!
At this point, it aims to be the most complete free and open source PHP library to read and write shapefiles out there and it's been used widely by many users in the last few years, but should you find any bug with it, please report it and/or open an issue and it will be promptly fixed.

更新1:
从v2.0.0版本开始,PHP Shapefile能够读取Z和M形状文件,本机访问DBF,与PHP 7兼容等等.我正在积极开发此功能,因此可以提供功能请求.

UPDATE 1:
Since v2.0.0, PHP Shapefile is capable of reading Z and M shapefiles, natively access DBF, is PHP 7 compatible and much more. I am actively developing this, so feature requests are available.

我不想在一个老问题上破坏关于我自己的图书馆的任何规则发布,但是在Google上搜索php shapefile时,该页面会在第一个结果中弹出,因此我认为这可能对那些正在寻找像我以前那样的图书馆.

I don't want to break any rule posting about my own library in an old question, but this page pops up in the firsts result when searching for php shapefile on Google, so I thought it might be useful for someone who is looking for such a library as I used to.

我一直在寻找一个不错的库来亲自在PHP中导入ESRI Shapefile,而最终我自己构建了一个库.它可以读取所有 2D shapefile 类型的shapefile和DBF数据,并且应该100%无错误.
到目前为止,它已经在生产中使用了几个月,所以我公开发布了任何想要使用它的人:

I've been looking for a decent library to import ESRI Shapefiles in PHP myself, and I ended up building my own. It can read all 2D shapefiles kinds of shapefiles and DBF data and it should be 100% bug free.
It's been used in production for a few months by now, so I made public release for anybody who would like to use it:

https://github.com/gasparesganga/php-shapefile

这篇关于如何在php中添加形状文件(.shp)并在php文件中使用该形状文件数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆