[gdal-dev] Ogrtindex: schema consistency check too strict?

Even Rouault even.rouault at spatialys.com
Tue Mar 17 09:35:13 PDT 2015


Selon "Rahkonen Jukka (MML)" <jukka.rahkonen at maanmittauslaitos.fi>:

> Hi,
>
> I created ogrtileindex with -accept_different_schemas option and at least I
> can render WMS maps with Mapserver 6.4 with it. I need those integer
> attributes for classification but not for WFS at least by now.
>
> I fear that there is no GDAL tool that could unify the data types by lifting
> Number(9.0) into Number(10.0) in the dfb headers of my shapefiles.

Not just the headers, the records also need to be extended. Shapefiles support
the AlterFieldDefn() API, so you could issue a SQL like "ALTER TABLE mytable
ALTER COLUMN mycol TYPE bigint(10)", but as I'm writing that I'm not sure that
the code to support that promotion has yet been written.

> Rewriting
> everything into common schema could be on option even it would take some time
> because this data set is about 600 GB. But how could I define such a  common
> output schema?

If the data in the Number(10.0) doesn't exceed 2 billion, then you can use the
-accept_different_schemas trick as the data will fit on 32 bit integer.
Otherwise you could wrap the data into OGR VRT

>
> -Jukka Rahkonen-
>
> -----Alkuperäinen viesti-----
> Lähettäjä: Even Rouault [mailto:even.rouault at spatialys.com]
> Lähetetty: 17. maaliskuuta 2015 17:52
> Vastaanottaja: Rahkonen Jukka (MML)
> Kopio: gdal-dev at lists.osgeo.org
> Aihe: Re: [gdal-dev] Ogrtindex: schema consistency check too strict?
>
> Jukka,
>
> Accepting both Integer and Integer64 as the same could cause problems. For
> example let's say you have a ogr tile index whose first dataset has a
> "foo(Integer)" field and the second dataset is "foo(Integer64)". In
> gml_types=auto mode, I believe that MapServer will use the schema of the
> first dataset for the whole tiles, so you could have truncation of Integer64
> values.
>
> By the way, Integer64 bit support in MapServer is sitting in this pull
> request:
> https://github.com/mapserver/mapserver/pull/5061
>
> Even
>
> > Hi,
> > Probably because of work done for 64 bit integer support ogrtindex in
> > now nagging that schemata of shapefiles with fields defined as
> > Number(9.0) and
> > Number(10.0) do not match. The first is reported as Integer and the
> > latter as Integer64. However, that difference should not have any
> > meaning for ogrtindex utility or Mapserver that is using the index file.
> >
> > For being able to create indexes for our data I have had to run
> > orgtindex with -accept_different_schemas option which is all right
> > otherwise but it accepts also all the meaningful differences which can
> > make real harm for Mapserver.
> >
> > I think that Integer and Integer64 could be made to mean the same for
> > ogrtindex but I am not sure if it could have some consequences.
> >
> > -Jukka Rahkonen-
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
>
>
> --
> Spatialys - Geospatial professional services http://www.spatialys.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list