用于解析MapInfo TAB格式的Java API [英] Java API for parsing MapInfo TAB format

查看:368
本文介绍了用于解析MapInfo TAB格式的Java API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在解析Java中的MapInfo TAB格式文件.它由一组四个文件组成,即.TAB,.ID,.MAP和.DAT.在网上搜索后,我在此存储库中遇到了GeoTools提供的解析器: https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/MapInfoFileReader.java

I am working on parsing a MapInfo TAB Format file in Java. It consists of a set of four files viz .TAB, .ID, .MAP and .DAT. After searching on web I came across a parser provided by GeoTools at this repository: https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/MapInfoFileReader.java

当我使用此API解析MAPInfo TAB格式文件包时,该API会引发异常:

When I use this API for parsing the MAPInfo TAB format file bundle, the API throws exception:

在.tab文件中找不到最少三个控制点."

"Didn't find a minimum of three control points in the .tab file."

我正在使用公共MapInfoFileReader(最终文件标签文件)构造函数.我尝试使用不同版本的Geotools API.

I am using public MapInfoFileReader(final File tabfile) constructor. I have tried using different versions of Geotools API.

是否可以解决Java中的MapInfo TAB格式文件?或者,如果有人可以提供使用GeoTools的MapInfoFileReader的示例代码

Is there a work around for parsing MapInfo TAB Format file in Java? Or if anyone can provide sample code for using GeoTools' MapInfoFileReader

推荐答案

没有使用Java代码解析.TAB的直接方法.首先,您需要使用Gdal 1 或ogr2ogr将.TAB转换为KML或其他扩展名这个命令行工具

There is no direct way to parse .TAB using java code. First of all you need to convert .TAB into KML or other extension using Gdal1 or ogr2ogr using this command line tool

ogr2ogr -f"KML"文件路径/文件名.kml"文件路径/文件名.TAB"

ogr2ogr -f "KML" "filepath/filename.kml" "filepath/filename.TAB"

之后,您可以使用DOM解析器使用Java代码解析.kml文件

After that you can parse .kml file using java code using DOM parser2 API available in java.

这篇关于用于解析MapInfo TAB格式的Java API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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