[MapServer-users] Issues with coordinate precision GeoJSON

Jaime Valdez jvaldezch at gmail.com
Wed Jun 21 16:37:59 PDT 2023


Hi everyone,

I'm having issues with MapServer 8 setting up precision or decimal places
as Point GeoJSON on the following map, no matter if I
set wfs_geometry_precision or wfs_precision the result is roundup to
integer.

By the way this did not happen before upgrading to MapServer 8.

This is my map:

MAP
    IMAGETYPE png24

    OUTPUTFORMAT
        NAME "png"
        DRIVER AGG/PNG
        MIMETYPE "image/png"
        IMAGEMODE RGBA
        EXTENSION "png"
        FORMATOPTION "GAMMA=0.75"
    END

    OUTPUTFORMAT
      NAME "geojson"
      DRIVER "OGR/GEOJSON"
      FORMATOPTION "FORM=SIMPLE"
      FORMATOPTION "LCO:RFC7946=YES"
      FORMATOPTION "COORDINATE_PRECISION=8"
      FORMATOPTION "LCO:COORDINATE_PRECISION=8"
      FORMATOPTION "LCO:NATIVE_DATA=NO"
      FORMATOPTION "STORAGE=stream"
      MIMETYPE "application/json; subtype=geojson"
    END

    PROJECTION
        "+init=epsg:4326"
    END

    WEB
        METADATA
            "ows_enable_request" "*"
            "wfs_enable_request" "*"
            "wfs_srs"            "EPSG:4326"
            "ows_srs"            "EPSG:4326"
            "wfs_getfeature_formatlist"
"gml,geojson,shapezip,dbfzip,spatialite,application/json"
        END
    END

    LAYER
        NAME "boyas_cuba"
        METADATA
            "wfs_title"                 "Points"
            "wfs_srs"                   "EPSG:4326"
            "gml_include_items"         "all"
            "gml_featuredid"            "id"
            "wfs_geometry_precision"    "10"
            "wfs_precision"             "10
        END
        TYPE POINT
        STATUS ON
        CONNECTIONTYPE POSTGIS
        CONNECTION "...."
        DATA "geom from (SELECT id, geom, latitude::float,
longitude::float, code, name FROM point_table) AS subquery USING UNIQUE id
USI$
PROJECTION
            "+init=epsg:4326"
        END
    END
END

This gives me coordinates round up:

{
    "type": "FeatureCollection",
    "name": "Some points",
    "features": [
        {
            "type": "Feature",
            "properties": {
                "id": "405",
                "latitude": "22.15667",
                "longitude": "-81.50164",
                "code": "ECZ",
                "name": "Ensenada de Cazones, Golfo de Cazones"
            },
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -82,
                    22
                ]
            }
        },
        {
            "type": "Feature",
            "properties": {
                "id": "391",
                "latitude": "21.93147",
                "longitude": "-83.53089",
                "code": "SIJ",
                "name": "El Sijú, San Felipe"
            },
            "geometry": {
                "type": "Point",
                "coordinates": [
                    -84,
                    22
                ]
            }
        },
...
}

Thanks in advanced,
---
 Jaime E. Valdez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20230621/8a7bbe88/attachment.htm>


More information about the MapServer-users mailing list