GPS坐标系转换:点、区域序列化与反序列化、类型处理
This commit is contained in:
parent
4bef9ce778
commit
2ff0acb9c3
@ -23,7 +23,7 @@ public class PGpointDeserializer extends JsonDeserializer<PGpoint> {
|
||||
|
||||
try {
|
||||
// 方式1: GeoJSON 格式
|
||||
if (node.isObject()) {
|
||||
if (node.isObject() && node.has("type") && "point".equals(node.get("type").asText())) {
|
||||
JsonNode longitude = node.get("longitude");
|
||||
JsonNode latitude = node.get("latitude");
|
||||
if (longitude != null && latitude != null) {
|
||||
|
||||
@ -21,6 +21,7 @@ public class PGpointSerializer extends JsonSerializer<PGpoint> {
|
||||
|
||||
// 方式1: 序列化为 GeoJSON 格式(推荐)
|
||||
gen.writeStartObject();
|
||||
gen.writeStringField("type","point");
|
||||
gen.writeNumberField("longitude",point.x);
|
||||
gen.writeNumberField("latitude",point.x);
|
||||
// gen.writeArrayFieldStart("coordinates");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user