Support GDAL 2.0 64bit integer fields #5061

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@rouault
Contributor
rouault commented Jan 30, 2015

Now that http://trac.osgeo.org/gdal/wiki/rfc31_ogr_64 has been
committed in GDAL trunk 2.0dev, OFTInteger64 can be return as a
field type.
So :

  • when reading OGR layer, support mapping OFTInteger64 to a new "Long" datatype
  • when reading PostGIS layer, map INT8 columns to "Long" datatype
  • in mapwfs, map "Long" to xs:long
  • in OGR output code, map "Long" to OFTInteger64, if GDAL 2.0, or
    OFTReal otherwise

OGR_F_GetFID() in GDAL 2.0 returns a 64 bit integer. We just fix
warnings by casting to int, but if a 64bit FID was really returned,
we might have issues.

@rouault rouault changed the title from upport GDAL 2.0 64bit integer fields to Support GDAL 2.0 64bit integer fields Jan 30, 2015
@rouault rouault Support GDAL 2.0 64bit integer fields
Now that http://trac.osgeo.org/gdal/wiki/rfc31_ogr_64 has been
committed in GDAL trunk 2.0dev, OFTInteger64 can be return as a
field type.
So :
- when reading OGR layer, support mapping OFTInteger64 to a new "Long" datatype
- when reading PostGIS layer, map INT8 columns to "Long" datatype
- in mapwfs, map "Long" to xs:long
- in OGR output code, map "Long" to OFTInteger64, if GDAL 2.0, or
  OFTReal otherwise

OGR_F_GetFID() in GDAL 2.0 returns a 64 bit integer. We just fix
warnings by casting to int, but if a 64bit FID was really returned,
we might have issues.
31fbd16
@rouault
Contributor
rouault commented Jan 30, 2015

Given test_wfs_ogr_64bit.map :

MAP

NAME TEST
STATUS ON

OUTPUTFORMAT
  NAME "CSV"
  DRIVER "OGR/CSV"
  MIMETYPE "text/csv"
  FORMATOPTION "LCO:GEOMETRY=AS_WKT"
  FORMATOPTION "STORAGE=filesystem"
  FORMATOPTION "FORM=simple"
  FORMATOPTION "FILENAME=result.csv"
END

OUTPUTFORMAT
  NAME "CSVT"
  DRIVER "OGR/CSV"
  MIMETYPE "text/csv; csvt=yes"
  FORMATOPTION "LCO:GEOMETRY=AS_WKT"
  FORMATOPTION "LCO:CREATE_CSVT=YES"
  FORMATOPTION "STORAGE=filesystem"
  FORMATOPTION "FORM=multipart"
  FORMATOPTION "FILENAME=result.csv"
END

#
# Start of web interface definition
#
WEB

  METADATA
    "ows_updatesequence"   "123"
    "wfs_title"        "Test simple wfs"
    "wfs_onlineresource"   "http://localhost/path/to/wfs_simple?"
    "wms_title"        "Test simple wms"
    "wms_onlineresource"   "http://localhost/path/to/wms_simple?"
    "wms_srs"          "EPSG:27700"
    "ows_abstract"    "Test WFS Abstract"
    "ows_keywordlist" "ogc,wfs,gml,om"
    "ows_service_onlineresource" "http://localhost"
    "ows_fees" "none"
    "ows_accessconstraints" "none"
    "ows_addresstype" "postal"
    "ows_address"     "123 SomeRoad Road"
    "ows_city" "Toronto"
    "ows_stateorprovince" "Ontario"
    "ows_postcode" "xxx-xxx"
    "ows_country" "Canada"
    "ows_contactelectronicmailaddress" "tomkralidis@xxxxxxx.xxx"
    "ows_contactvoicetelephone" "+xx-xxx-xxx-xxxx"
    "ows_contactfacsimiletelephone" "+xx-xxx-xxx-xxxx"
    "ows_contactperson" "Tom Kralidis"
    "ows_contactorganization" "MapServer"
    "ows_contactposition" "self"
    "ows_hoursofservice" "0800h - 1600h EST"
    "ows_contactinstructions" "during hours of service"
    "ows_role" "staff"
    "wms_feature_info_mime_type" "text/csv"
    "ows_enable_request" "*" 
  END
END

PROJECTION
    "init=epsg:27700"
END

LAYER
  NAME test
  CONNECTIONTYPE OGR
  CONNECTION "test.csv" 

  METADATA
    "wfs_title"         "test"
    "wfs_featureid"     "ID"
    "wfs_srs"           "EPSG:27700"
    "wfs_getfeature_formatlist" "csv,csvt"
    "gml_include_items" "all"
    "gml_exclude_items" "WKT"
    "gml_types"         "auto"
    "wfs_geomtype"      "Geometry"
  END
  TYPE POLYGON
  STATUS ON
  PROJECTION
    "init=epsg:27700"
  END

  DUMP TRUE
END

END # Map File

and test.csv:

id,val,WKT
1,1234567890123,"POLYGON((-60 -60,-60 60,60 60,60 -60,-60 -60))"

and test.csvt:

Integer,Integer64,WKT
mapserv QUERY_STRING="map=test_wfs_ogr_64bit.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType"

gives :

Content-Type: text/xml; subtype=gml/3.1.1; charset=UTF-8

<?xml version='1.0' encoding="UTF-8" ?>
<schema
   targetNamespace="http://mapserver.gis.umn.edu/mapserver" 
   xmlns:ms="http://mapserver.gis.umn.edu/mapserver" 
   xmlns:ogc="http://www.opengis.net/ogc"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns="http://www.w3.org/2001/XMLSchema"
   xmlns:gml="http://www.opengis.net/gml"
   elementFormDefault="qualified" version="0.1" >

  <import namespace="http://www.opengis.net/gml"
          schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" />

  <element name="test" 
           type="ms:testType" 
           substitutionGroup="gml:_Feature" />

  <complexType name="testType">
    <complexContent>
      <extension base="gml:AbstractFeatureType">
        <sequence>
          <element name="msGeometry" type="gml:GeometryPropertyType" minOccurs="0" maxOccurs="1"/>
          <element name="id" minOccurs="0" type="integer"/>
          <element name="val" minOccurs="0" type="long"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

</schema>
mapserv QUERY_STRING="map=test_wfs_ogr_64bit.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=test&OUTPUTFORMAT=text/csv; csvt=yes"

gives

Content-Type: multipart/mixed; boundary=xxOGRBoundaryxx

--xxOGRBoundaryxx
Content-Disposition: attachment; filename=result.csv
Content-Type: application/binary
Content-Transfer-Encoding: binary

WKT,id,val
"POLYGON ((-60 -60,-60 60,60 60,60 -60,-60 -60))",1,1234567890123

--xxOGRBoundaryxx
Content-Disposition: attachment; filename=result.csvt
Content-Type: application/binary
Content-Transfer-Encoding: binary

String,Integer,Integer64

--xxOGRBoundaryxx--
@mapserver-bot

This is an automated comment

This issue has been closed due to lack of activity. This doesn't mean the issue is invalid, it simply got no attention within the last year. Please reopen with missing/relevant information if still valid.

Typically, issues fall in this state for one of the following reasons:

  • Hard, impossible or not enough information to reproduce
  • Missing test case
  • Lack of a champion with interest and/or funding to address the issue
@tbonfort tbonfort reopened this Feb 23, 2016
@tbonfort
Member

@rouault any reason this was not applied to the mapserver repo ?

@rouault
Contributor
rouault commented Feb 24, 2016

We should definitely apply that, and possibly in 7.0.1 since it will be really needed when GDAL 2.0 gets deployed more widely. I think I defered it because the 64bit int support required extending the syntax of the gml_[item name]_type metadata item whose doc is currently

    Specifies the type of the attribute. Valid values are the OGR data types: Integer|Real|Character|Date|Boolean. Mapserver translates these to valid GML data types. 

with a new type. I suggested Long because the current types are somehow close to the XML schema type names, and Long would fit with that pattern.

@tbonfort
Member

backported to 7.0 in 4238420

@tbonfort tbonfort closed this Feb 24, 2016
@tbonfort tbonfort added a commit to mapserver/msautotest_DEPRECATED that referenced this pull request Feb 24, 2016
@tbonfort tbonfort update results for mapserver/mapserver#5061 cf8ea4e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment