如何在java

时间:2018-04-17 22:50:40

标签: mysql spring hibernate geojson

我有一个问题,这种格式如何在java中使用hibernate和mysql?

这种格式可能是一种不那么复杂的事情

 {
      type: 'FeatureCollection',
      features: [{
        type: 'Feature',
        geometry: {
          type: 'Point',
          coordinates: [-77.032, 38.913]
        },
        properties: {
          title: 'Mapbox',
          description: 'Washington, D.C.'
        }
      },
      {
        type: 'Feature',
        geometry: {
          type: 'Point',
          coordinates: [-122.414, 37.776]
        },
        properties: {
          title: 'Mapbox',
          description: 'San Francisco, California'
        }
      }]
    }

1 个答案:

答案 0 :(得分:0)

你可以使用杰克逊工具的扩展geojson-Jackson。

  

所有GeoJson POJO(Plain Old Java Objects)的小包,用于通过JSON Jackson Parser对对象进行序列化和反序列化。

<强>用法

  

如果您知道GeoJson文件中您期望的对象类型,您可以直接读取它:

FeatureCollection featureCollection = 
new ObjectMapper().readValue(inputStream, FeatureCollection.class);

请参阅文档geojson-jackson

如果您正在寻找保存数据库中的结构,也许您应该尝试一个空间列。 查看Spatial typesgeojson functions