Commit 55574fdd90bf21fbd3fde13c863cf78a3f44c728
1 parent
32fd8507
1.
Showing
2 changed files
with
3 additions
and
57 deletions
pom.xml
| ... | ... | @@ -295,13 +295,6 @@ |
| 295 | 295 | <artifactId>jpinyin</artifactId> |
| 296 | 296 | <version>1.1.8</version> |
| 297 | 297 | </dependency> |
| 298 | - | |
| 299 | - <!-- geotool --> | |
| 300 | - <dependency> | |
| 301 | - <groupId>org.locationtech.jts</groupId> | |
| 302 | - <artifactId>jts-core</artifactId> | |
| 303 | - <version>1.16.1</version> | |
| 304 | - </dependency> | |
| 305 | 298 | </dependencies> |
| 306 | 299 | |
| 307 | 300 | <dependencyManagement> | ... | ... |
src/main/java/com/bsth/entity/Station.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | |
| 3 | -import com.bsth.util.Geo.Point; | |
| 4 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 5 | -import org.hibernate.annotations.Formula; | |
| 6 | -import org.locationtech.jts.geom.Geometry; | |
| 7 | -import org.locationtech.jts.io.WKBReader; | |
| 8 | 4 | |
| 9 | 5 | import javax.persistence.*; |
| 10 | - | |
| 11 | 6 | import java.util.Arrays; |
| 12 | 7 | import java.util.Date; |
| 13 | -import java.util.List; | |
| 14 | 8 | |
| 15 | 9 | |
| 16 | 10 | /** |
| ... | ... | @@ -276,14 +270,15 @@ public class Station { |
| 276 | 270 | } |
| 277 | 271 | |
| 278 | 272 | public String getBdPolygon() { |
| 279 | - if (bPolygonGrid == null) { | |
| 273 | + /*if (bPolygonGrid == null) { | |
| 280 | 274 | return null; |
| 281 | 275 | } |
| 282 | 276 | Geometry geometry = getGeometryFromBytes(getbPolygonGrid()); |
| 283 | 277 | if (geometry == null) { |
| 284 | 278 | return null; |
| 285 | 279 | } |
| 286 | - return geometry.toString(); | |
| 280 | + return geometry.toString();*/ | |
| 281 | + return ""; | |
| 287 | 282 | } |
| 288 | 283 | |
| 289 | 284 | public Integer getDestroy() { |
| ... | ... | @@ -342,48 +337,6 @@ public class Station { |
| 342 | 337 | this.updateDate = updateDate; |
| 343 | 338 | } |
| 344 | 339 | |
| 345 | - private static Geometry getGeometryFromBytes(byte[] geometryAsBytes) { | |
| 346 | - Geometry geometry = null; | |
| 347 | - try { | |
| 348 | - // 字节数组小于5,说明geometry有问题 | |
| 349 | - if (geometryAsBytes.length < 5) { | |
| 350 | - throw new Exception("Invalid geometry inputStream - less than five bytes"); | |
| 351 | - } | |
| 352 | - | |
| 353 | - //first four bytes of the geometry are the SRID, | |
| 354 | - //followed by the actual WKB. Determine the SRID | |
| 355 | - //这里是取字节数组的前4个来解析srid | |
| 356 | - byte[] sridBytes = new byte[4]; | |
| 357 | - System.arraycopy(geometryAsBytes, 0, sridBytes, 0, 4); | |
| 358 | - boolean bigEndian = (geometryAsBytes[4] == 0x00); | |
| 359 | - // 解析srid | |
| 360 | - int srid = 0; | |
| 361 | - if (bigEndian) { | |
| 362 | - for (int i = 0; i < sridBytes.length; i++) { | |
| 363 | - srid = (srid << 8) + (sridBytes[i] & 0xff); | |
| 364 | - } | |
| 365 | - } else { | |
| 366 | - for (int i = 0; i < sridBytes.length; i++) { | |
| 367 | - srid += (sridBytes[i] & 0xff) << (8 * i); | |
| 368 | - } | |
| 369 | - } | |
| 370 | - | |
| 371 | - //use the JTS WKBReader for WKB parsing | |
| 372 | - WKBReader wkbReader = new WKBReader(); | |
| 373 | - // 使用geotool的WKBReader 把字节数组转成geometry对象。 | |
| 374 | - //copy the byte array, removing the first four | |
| 375 | - //SRID bytes | |
| 376 | - byte[] wkb = new byte[geometryAsBytes.length - 4]; | |
| 377 | - System.arraycopy(geometryAsBytes, 4, wkb, 0, wkb.length); | |
| 378 | - geometry = wkbReader.read(wkb); | |
| 379 | - geometry.setSRID(srid); | |
| 380 | - } catch (Exception e) { | |
| 381 | - e.printStackTrace(); | |
| 382 | - } | |
| 383 | - | |
| 384 | - return geometry; | |
| 385 | - } | |
| 386 | - | |
| 387 | 340 | @Override |
| 388 | 341 | public String toString() { |
| 389 | 342 | return "Station [id=" + id + ", stationCod=" + stationCod + ", stationName=" + stationName + ", roadCoding=" | ... | ... |