Geomatys / constellation

WARNING: Constellation-SDI Product and repository is now DEPRECATED, please use Examind Community instead.
https://github.com/Geomatys/examind-community
Other
16 stars 8 forks source link

Invalid formatting of coordinates in geojson WFS output #11

Closed stanguy closed 7 years ago

stanguy commented 7 years ago

Steps to reproduce:

  1. Deploy Constellation;
  2. Create a WFS service;
  3. Add default data as layers to the newly created service;
  4. Query the service on a layer in EPSG:3857 and with a geojson output format

    curl -s http://localhost:8080/constellation/WS/wfs/test\?request=GetFeature\&service=wfs\&version=1.1.0\&typeName=CNTR_RG_60M_2006\&srsName=epsg:3857\&outputFormat=application/json

In the resulting json output, coordinates are formatted according to what appears to be a US locale, with a comma as thousands separator

[
  3,
  94,
  378.337,
  8,
  522,
  166.3686
]

Edit: The SRS was incorrect in the curl command and the result was not (exactly) the one expected.

msidhoum commented 7 years ago

Hi @stanguy , I'm not sure to understand you To my knowledge for geojson format, the point (.) is already used as decimal separator,

here is some examples to illustrate that

{
      "type": "FeatureCollection",
      "crs": {
          "type": "name",
          "properties": {
            "name": "EPSG:3857"
          }
        },
        "features": [ {
          "type": "Feature",
          "geometry": {
            "type": "LineString",
            "coordinates": [[4.2e6, -1e6], [7.5e5, 1e6]]
          }
        }]
}

or with EPSG:4326

{ "type":"Feature",
   "id":"LSNE",
   "properties":{"name":"Lausanne"},
    "geometry":{"type":"Point","coordinates":[6.6339863,46.5193823]}}

the comma is used for json format separator.

Cheers.

stanguy commented 7 years ago

Indeed, the dot is already used as decimal separator, but for some reasons all my tests lead to the use of the comma as thousands separator (unlike your example, my results were not using scientific notation).

I've tested different deployments (Tomcat 7/8, Debian/Windows2012, Oracle JDK7/8 and OpenJDK8 --- all with v1.2.1, but I first double-checked on master), so I have no idea if my environment is the root cause.

If I save and import your json sample into my test service:

$ curl  'http://localhost:8080/constellation/WS/wfs/test?request=GetFeature&servce=wfs&version=2.0.0&typeNames=min&srsName=epsg:3857&outputFormat=application/json'
{
  "type" : "FeatureCollection",
  "features" : [ {
    "type" : "Feature",
    "id" : "id-0",
    "geometry" : {
      "type" : "LineString",
      "coordinates" : [ [ 4,200,000, -1,000,000 ], [ 750,000, 1,000,000 ] ]
    },
    "properties" : { }
  } ]
}
msidhoum commented 7 years ago

Just pushed a fix on master, @stanguy can you try to checkout the master and tell us if it works now ?

Best regards.

stanguy commented 7 years ago

Updated and tested: works for me now. Thank you!