[gdal-dev] ogr2ogr problem converting UK Ordnance Survey MasterMap

Even Rouault even.rouault at mines-paris.org
Tue Jul 13 13:58:54 EDT 2010


Jez,

Le Tuesday 13 July 2010 17:32:03 Jez Walters, vous avez écrit :
> Even,
>
>
> My ultimate objective is to read OS MasterMap GML using MapServer, but
> MapServer skips various fields when reading this GML directly.  I don't
> know if this is a fault with GDAL/OGR or with how MapServer is calling it. 

GDAL 1.7.2 will ignore fields that are seen as StringList by GDAL trunk, so 
that can accound why you don't see them in MapServer

> In order to overcome this restriction, I've been converting the GML to ESRI
> Shapefiles using ogr2ogr.  Fortunately, MapServer appears to have no
> difficulty reading ESRI Shapefiles!  :-)
>
> I've been playing with your latest GDAL code and the '-splitlistfields' and
> '-maxsubfields 1' options let me do this conversion, but it does seem
> rather slow now.

Yes definitely -splitlistfields is bound to be a slow process as it needs a 
full initial scan of the whole layer to figure out the maximum number of 
items for each list field. But your remark about -maxsubfields 1 has made me 
think that there's an easy optimization in that particular case where no scan 
is actually needed. Incorporated in trunk now !

> Please don't misunderstand me, but given that GDAL v1.7.2 
> works too without these options it's difficult to see the gain for what I
> am trying to achieve.

Hum I guess you mean it works with 1.7.2 if you don't care about the ignored 
fields, or you changes the original GML file to 'flatten' it.

>
> Perhaps it would be possible to speed things up by combining the stages
> that produce the '.resolved.gml' and '.gfs' files?

Chaintanya replied on that in a previous post, but the making of .resolved.gml 
and .gfs files is completely different right now. Not sure what Chaintanya's 
future plans are.

>
>
> Jez
>
>
> -----Original Message-----
> From: Even Rouault [mailto:even.rouault at mines-paris.org]
> Sent: Monday 12 July 2010 22:09
> To: gdal-dev at lists.osgeo.org
> Cc: Jez Walters; 'Martin Daly'
> Subject: Re: [gdal-dev] ogr2ogr problem converting UK Ordnance Survey
> MasterMap
>
> Jez,
>
> if you checkout latest GDAL trunk, you'll find a new -splitlistfields
> option for ogr2ogr that will split fields of type IntegerList, RealList or
> StringList into as many subfields of single type as necessary. You can also
> specify -maxsubfields an_integer_value to limit the number of subfields
> (can be usefull if you just want to keep the first element of the list, or
> to keep the number of subfields to a reasonable number, as some features
> from your GML file have a big number of elements in the list)
>
> Even
>
> Le Monday 12 July 2010 20:04:00 Even Rouault, vous avez écrit :
> > Jez,
> >
> > Yes this is a limitation of the shapefile format (and most drivers,
> > PostgreSQL databases being one of the exceptions).
> >
> > Try adding -fieldTypeToString IntegerList,RealList,StringList to your
> > ogr2ogr command line. This will transform any field of those types into a
> > String field by concatenating the values into a single string (what you
> > can see with ogrinfo). Beware that if the list if longer more than a few
> > items, there will be a truncation at 80 characters.
> >
> > I'm considering to see if it's practical or not to add an option to
> > ogr2ogr to split fields of type *List into several fields of simple type.
> >
> > Best regards,
> >
> > Even
> >
> > PS: For the record, in http://download.osgeo.org/gdal/daily/, you can
> > find daily snapshots of the source code of the trunk (1.8.0dev) and the
> > 1.7 stable branch.
> >
> > Le Monday 12 July 2010 18:09:16 Jez Walters, vous avez écrit :
> > > Even,
> > >
> > >
> > > I've just rebuilt GDAL/OGR using the latest code from the GDAL 'trunk',
> > > but now I get the following error using ogr2ogr to convert an OS
> > > MasterMap chunk (e.g.
> > > http://www.ordnancesurvey.co.uk/oswebsite/products/innovations/sampleda
> > >ta /O SMasterMap_Topo/58116-SX9192-2c1.gz) into ESRI shapefiles:
> > >
> > > "ERROR 6: Can't create fields of type StringList on shapefile layers."
> > >
> > > The various fields for which this error is reported do not appear to be
> > > in the resultant shapefiles. Unfortunately this makes the new GDAL code
> > > unusable for me.  :-(
> > >
> > > Any thoughts?
> > >
> > >
> > > Jez
> > >
> > >
> > > -----Original Message-----
> > > From: Even Rouault [mailto:even.rouault at mines-paris.org]
> > > Sent: Sunday 11 July 2010 11:12
> > > To: gdal-dev at lists.osgeo.org
> > > Cc: Martin Daly; Peter J Halls; Jez Walters
> > > Subject: Re: [gdal-dev] ogr2ogr problem converting UK Ordnance Survey
> > > MasterMap
> > >
> > > Just to inform you that now that the NAS driver is in GDAL trunk, I've
> > > been able to port its enhancements to the main GML driver. On the few
> > > samples I've tested, OS Mastermap GML files seem to be read correctly
> > > now.
> > >
> > > See http://trac.osgeo.org/gdal/ticket/3680
> > >
> > > Le Friday 02 July 2010 09:04:38 Martin Daly, vous avez écrit :
> > > > >     Here it is not only GDAL/OGR that has a problem!  Currently, I
> > > > > know of no importer that can handle this construct, other than the
> > > > > tool (from Snowflake) used by OSGB to generate it - and there is
> > > > > also the question of onwards storage.
> > > >
> > > > Not even close, I'm afraid.
> > > >
> > > > There are plenty of tools to read (all parts of) OS MM:
> > > >
> > > > http://www.ordnancesurvey.co.uk/oswebsite/products/osmastermap/inform
> > > >at io n/ technical/software.html
> > > >
> > > > e.g. (an excellent one, at a very reasonable price...)
> > > >
> > > > http://www.ordnancesurvey.co.uk/oswebsite/products/osmastermap/inform
> > > >at io n/ technical/software/cadcorp.html
> > > >
> > > > Also, as far as I am aware, OS GB use in-house software to generate
> > > > the data.
> > > >
> > > > Martin
>
> The information transmitted is intended only for the person
> or entity to which it is addressed and may contain
> confidential and/or privileged material. If you are not the
> addressee, any disclosure, reproduction, copying,
> distribution, or other dissemination or use of this
> communication is strictly prohibited. If you have received
> this transmission in error please notify the sender
> immediately and then delete this email.
>
> Any representations or commitments expressed in this email
> are subject to contract.
>
> This message has been scanned for viruses and dangerous
> content. However, it is essential that the recipient also
> checks this message using commercially available mail
> scanning and anti-virus software. IPL Information Processing
> Limited accepts no liability for any loss or damage resulting
> from any virus or other dangerous content in this message.
>
> IPL Information Processing Limited is registered in England
> and Wales under company registration number 1418818.
> Registration took place at Cardiff on 10 May 1979. IPL
> Information Processing Limited's registered office and
> normal place of business is Eveleigh House, Grove Street,
> Bath, BA1 5LR, United Kingdom. IPL is also registered for
> Value Added Tax (VAT) under registration number GB 601 2931 83.




More information about the gdal-dev mailing list