Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 ogr2ogr 将 .shp 文件转换为 .geojson 格式,我可以从(linux)命令行执行此操作。但是,不是命令行转换,我想从 php 脚本调用转换(使用例如 exec(..) )并将输出直接发送到变量(作为字符串)而不是写入文件。这可能吗?
您可以使用 PHP 中可用的 shell_exec() 方法。
public function shptogeojson($shpfilepath,$output,$srsno,$srsold){ $query="ogr2ogr -f GeoJSON -t_srs EPSG:$srsno -s_srs EPSG:$srsold $output.shp $shpfilepath"; shell_exec($query); }