Search code examples
gpslatitude-longitudemultilinestringwktone-simulator

How to convert GPS Long/Lat values to .WKT formatted LINESTRINGS?


I have GPS data which includes longitude and latitude information such as:

1 - longitude = 121.469600 latitude = 31.291600

2 - longitude = 121.432800 latitude = 31.307100

...

I need to convert this points to LINESTRING function and create .wkt formated file and I will use this file to create routes at THE ONE simulator. I have example .wkt file such as:

LINESTRING (2552480.8583879373 6673392.573941387, 2552720.809051393 6673409.434952837, 2552930.1703346907 6673422.44040407, 2553055.669603237 6673293.861283979, 2553058.119715625 6673058.3372244015, 2553281.9791423935 6672606.85359586, 2553180.9635660085 6672364.467961353, 2552883.7245106613 6672239.799346303, 2552708.001130296 6672220.484913082, 2552440.7491407027 6672213.753367998, 2552483.811722061 6672500.92928317, 2552341.7794494093 6672696.104081427, 2552261.900555275 6672932.613958296, 2552508.7708714856 6673110.496865532)

I do not understand what is this values (exp: 2552480.8583879373 6673392.573941387) inside LINESTRING function? How can I convert my long/lat values to this?


Solution

  • These are coordinate values in the "well-known text" format: https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry

    You can check out the WKTReader class for details how they are turned into ONE simulator coordinates (basically, one-to-one): https://github.com/akeranen/the-one/blob/master/src/input/WKTReader.java