How to handle WKT data in Android?

前端 未结 5 1263
傲寒
傲寒 2020-12-18 11:22

I have data in this format:

POINT(73.0166738279393 33.6788721326803)
MULTILINESTRING((73.0131224998036 33.679001500419,73.0119635003153 33.678392400389,73.01         


        
5条回答
  •  醉酒成梦
    2020-12-18 12:00

    A WKT (well-known-text) file describes an ISO 19107 Geometry. Personally I try to avoid re-inventing the wheel, or "mess" with them in self written parsers ( you never know, whether your function covers all situation just because it worked once).

    So here's another nice looking open source API, with examples, tutorials:

    http://docs.geotools.org/

    And here the WKTParser class

    http://docs.geotools.org/stable/javadocs/org/geotools/geometry/text/WKTParser.html

    Android Studio: Simply add this to your app build.gradle file:

    dependencies {
        /* your other dependencies */
        compile 'org.opengis:geoapi:3.0.0'
    }
    

提交回复
热议问题