Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to import spatial data layers in mysql

Shulou Source: shulou.com Published: 2022-06-02 06:54:15 09月11日 Update

How to import spatial data layers in mysql, aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

After a certain version of mysql, it can support the storage of spatial data. When you create a new table in myql, you can see the three field type settings of point, linestring and polygon, corresponding to the point, line and surface data of the storage space.

Vector layers can be imported into the mysql database using shp2mysql. Here's how to import spatial data into the mysql database by converting spatial data into wkt in other ways. The description of wkt can be found in the first paragraph of the official account TE that converts coordinates according to the coordinate system wkt.

Geojson transform wkt also has an open source nodejs class library, see GIS Development: conversion of GeoJSON coordinates and WKT. First of all, query the spatial data table of mysql and show that the result of spatial data is in wkt format.

The way the data is exported as a sql statement, you can see that the data is imported through mysql's spatial function GeomFromText (wkt string).

Therefore, as long as the coordinate information of spatial layer data is processed into the form of wkt, the data of mysql database can be imported.

Can be developed, you can use the above class library to deal with the spatial layer, spliced into sql statements, directly imported into the mysql database. Or, with the help of postgresql database, after importing the space, use the st_astext () space function to query the data results of wkt, and then export it into the form of sql statement for processing, and import it into the mysql database. For the data stored in this kind of database, as long as the data format is clear, it can be processed accordingly.

This is the answer to the question about how to import spatial data layers in mysql. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Tags: Data space database coordinates processing storage way statement problem function form more format result help development query solution easy clear Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Huawei Redmi vpn NVidia