0

I have a point stored in the DB with the coordinates in EPSG:4326 with the lat,long in decimal degrees, like so [ -45.0692283167, 170.9912843167 ]

When I request the following vector tile, I get the coordinates with only 2 decimal places

http://localhost:8080/geoserver/gwc/service/tms/1.0.0/workspace:layername@EPSG:900913@geojson/30/1046872282/385959631.geojson

enter image description here

How can I make the resulting GeoJSON to show more decimal places?

4
  • 1
    The second decimal place in the output stands for centimeters and corresponds roughly the 7th decimal place in degrees. I believe that the coordinate transformation does not have any better accuracy. Or do you think that you will need millimeters?
    – user30184
    Commented Sep 18, 2023 at 7:30
  • yeah, I need milimeters...
    – Falcoa
    Commented Sep 18, 2023 at 7:32
  • There isn't much geographic data that's accurate to a decimeter, much less a millimeter. If you need millimeters, your first task will have to be recollecting all the spatial data in use at 100 microns. Then again, the intrinsic error in Web Mercator is such that you could just round to the nearest 100 meters without a degradation in quality.
    – Vince
    Commented Sep 18, 2023 at 14:18
  • Your answer is not helpful because this is a matter of precision, not accuracy. I just wanted to know why the result is coming with only two decimal places and I believe Andrea has answered it.
    – Falcoa
    Commented Sep 18, 2023 at 22:08

1 Answer 1

3

The precision is hardcoded to 2 decimals for metric systems:

https://github.com/geoserver/geoserver/blob/main/src/extension/vectortiles/src/main/java/org/geoserver/wms/geojson/GeoJsonWMSBuilder.java#L67

It should be easy to make it tunable with a system variable (or a GUI if you want, but there is no existing vector tiles config UI to start from, you'll have to create one). If you make these changes, the project would appreciate a contribution.

2
  • Thanks for your answer Andrea. Very helpful. I will take a look. The only issue is that we are using the official GeoServer docker image, so this makes it harder
    – Falcoa
    Commented Sep 18, 2023 at 21:49
  • Contribute a change to the official codebase then, and it will get into the official docker image Commented Sep 19, 2023 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.