Because my current company is doing remote sensing monitoring, I often come into contact with various map and polygon data formats at the front end, but I am not very familiar with these, so I will make a record.
time
The database is often stored in a format, and the geometric objects represented include: points, lines, polygons, TIN (triangular irregular network) and polyhedrons.
example:
POINT(6 10)
LINESTRING(3 4,10 50,20 25)
POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))
MULTIPOINT(3.5 5.6, 4.8 10.5)
MULTILINESTRING((3 4,10 50,20 25),(-5 -8,-10 -8,-15 -4))
MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2)),((6 3,9 2,9 4,6 3)))
GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))
POINT ZM (1 1 5 60)
POINT M (1 1 80)
POINT EMPTY
MULTIPOLYGON EMPTY
GeoJSON
Express and store geographic data using JSON syntax
{
"type": "FeatureCollection",
"features": [
{
"type":"Feature",
"properties":{
},
"geometry":{
"type":"Point",
"coordinates":[105.380859375,31.57853542647338]
}
}
]
}
mutual conversion
The solution used by the company is the wkx package, which can be imported and directly called aip for conversion
const geojson = wkx.Geometry.parse(wkt).toGeoJSON();
const wkt = wkx.Geometry.parseGeoJSON(geojson).toWkt();