insert geospatial datatype( mutipolygon) in mysql with java( jdbc)

前端 未结 3 1750
旧时难觅i
旧时难觅i 2020-12-22 10:23

I am using geotools library to extract the location information. With that I am getting an object of type

class com.vividsolutions.jts.geom.MultiPolygon
         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-22 11:15

    Answer

    1. You need to convert the geometry object you have to well known text. You'll find information on how to do that in the vividsolutions API documentation.

      geoobject.toText();
      
    2. Insert / Update the data using the mysql GeomFromText method.

      INSERT INTO geom VALUES (GeomFromText(@g));
      

提交回复
热议问题