PHP GDAL/OGR库的使用,哪种方法更干净? [英] PHP GDAL/OGR library usage, which approach is cleaner?

查看:193
本文介绍了PHP GDAL/OGR库的使用,哪种方法更干净?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将在新项目中使用gdal/ogr.我想要一个精简但功能齐全的应用程序,因此不会使用其他实现,例如mapserver,因为它们具有多余的组件,我怀疑在应用程序中甚至将来都需要这些组件.作为记录,它是一个GIS,但我在此询问,因为在php中使用

I will be using gdal/ogr for a new project. I want a lean but fully functional app, so will not be using other implementations such as mapserver, because they have extraneous components that I doubt will be needed in the application, even in the future. For the record, it is a GIS, but I am asking here on SO because there as so few examples of a GIS in php that uses GDAL/OGR

我基本上会想到三个选择:

  • 使用php的exec()函数运行命令行转换实用程序

  • use php's exec() function to run command line conversion utilities

使用swig生成.dll并将其作为扩展加载到php

Use swig to generate a .dll and load it as an extension on php

使用geonfr @ https://github.com/编写的php包装器geonef/php5-gdal/wiki

Use the php wrapper written by geonfr @https://github.com/geonef/php5-gdal/wiki

您认为哪种方法最有效地实施了图书馆?

Which do you think is the most effective way to implement the library?

推荐答案

我最终使用了exec函数,主要是因为没有时间亲自进行swig或php扩展开发,这对我来说是首选方法. //这是用法的一小段示例,希望它可以对其他人有用

I wound up using the exec functions, mostly because there was no time to get into swig or php extension development, which were the preferred methods for me, personally. // here is a small sample snippet of it's usage, hopefully it will come in handy for someone else

public function convertToNewFormat($format)
        {
                return(
                    exec('ogr2ogr -f '
                        .$format
                        .' '.self::setNewFileLocation()
                        .' '.self::setOldFileLocation()));

        }

这篇关于PHP GDAL/OGR库的使用,哪种方法更干净?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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