[gdal-dev] Reading gml with schema

Ari Jolma ari.jolma at gmail.com
Tue May 28 10:47:38 PDT 2013


On 05/28/2013 05:34 PM, Lauri Kajan wrote:
> Hi Ari,
>
> I think that shouldn't be neccessary.
> The gml file points to the xsd schema file 
> (http://xml.nls.fi/XML/Schema/Maastotietojarjestelma/MTK/201202/Maastotiedot.xsd).
> In this schema those tags are defined to be "aliases" for these known 
> gml tags by using the substitutionGroup. So actually that 
> <Maastotiedot> is a <gml:FeatureCollection>. Is this supported by OGR?

I think GDAL wants the xsd to be local file for GML files. However, I 
tried this and I can see GDAL finding the xsd, but failing the overall 
process. Further, it seems that GDAL does not recognize the XML include tag.

Anyway, I assume it is not a simple substitution as all features should 
be wrapped into gml:featureMember elements.

Ari

>
> I'm not an xml/gml expert either so it's hard to find the problem.
>
> -Lauri
>
>
>
>
>
> On Tue, May 28, 2013 at 5:11 PM, Ari Jolma <ari.jolma at gmail.com 
> <mailto:ari.jolma at gmail.com>> wrote:
>
>     Lauri,
>
>     There are at least these issues with the file:
>
>     - Piste should be gml:Point
>     - Murtoviiva should be gml:LineString
>     - Alue should be gml:Polygon
>     - all features should be wrapped into gml:featureMember elements
>     - everything should be in gml:FeatureCollection
>     - complex geometries should be wrapped into gml:GeometryCollection
>     elements
>
>     With these changes and limitations I can open (a small piece) of
>     the file with ogrinfo. All are probably changeable by XSLT. Of
>     course my knowledge about GML and it's parsing in GDAL is limited,
>     so take this with a grain of salt.
>
>     Cheers,
>
>     Ari
>
>     the changed piece:
>
>     <?xml version="1.0" encoding="UTF-8"?>
>     <gml:FeatureCollection xmlns:gml="http://www.opengis.net/gml"
>     <http://www.opengis.net/gml>>
>     <harvatLouhikot>
>         <gml:featureMember>
>             <HarvaLouhikko gid="733051928" dimension="3">
>     <sijaintitarkkuus>10000</sijaintitarkkuus>
>     <korkeustarkkuus>100001</korkeustarkkuus>
>                 <aineistolahde>1</aineistolahde>
>                 <alkupvm>2005-11-15</alkupvm>
>                 <suunta>0</suunta>
>                 <sijainti>
>                     <gml:Point>
>                         <gml:pos srsDimension="3">368845.895
>     7588505.642 308.292</gml:pos>
>                     </gml:Point>
>                 </sijainti>
>                 <kohderyhma>13</kohderyhma>
>                 <kohdeluokka>34200</kohdeluokka>
>             </HarvaLouhikko>
>             </gml:featureMember>
>         </harvatLouhikot>
>     <hietikot>
>         <gml:featureMember>
>             <Hietikko gid="775477697" dimension="3">
>     <sijaintitarkkuus>5000</sijaintitarkkuus>
>                 <aineistolahde>1</aineistolahde>
>                 <alkupvm>2005-11-15</alkupvm>
>                 <sijainti>
>                 <gml:GeometryCollection>
>                 <gml:geometryMember>
>                     <gml:Point>
>                         <gml:pos srsDimension="3">368010.039
>     7584945.893 0.000</gml:pos>
>                     </gml:Point>
>                     </gml:geometryMember>
>                     <gml:geometryMember>
>                     <gml:Polygon>
>                         <gml:exterior>
>                             <gml:LinearRing>
>                                 <gml:posList
>     srsDimension="3">368000.000 7584931.821 370.229 368000.000
>     7584936.222 369.780 368001.115 7584941.126 368.906 368002.650
>     7584954.132 364.859 368002.478 7584969.653 361.051 368008.553
>     7584975.749 359.563 368016.839 7584970.791 359.517 368019.890
>     7584958.174 360.232 368023.171 7584944.026 362.917 368022.143
>     7584935.253 365.008 368016.168 7584924.893 368.340 368004.859
>     7584923.913 369.824 368000.000 7584931.821 370.229</gml:posList>
>                             </gml:LinearRing>
>                         </gml:exterior>
>                     </gml:Polygon>
>                     </gml:geometryMember>
>                     </gml:GeometryCollection>
>                 </sijainti>
>                 <kohderyhma>64</kohderyhma>
>                 <kohdeluokka>34300</kohdeluokka>
>             </Hietikko>
>             </gml:featureMember>
>         </hietikot>
>     </gml:FeatureCollection>
>
>
>
>     On 05/28/2013 02:06 PM, Lauri Kajan wrote:
>>     Hello everybody,
>>
>>     I have tired to read gml file from National Land Suvey of Finnish
>>     without a success.
>>     Does anybody have any idea what's the problem?
>>
>>     The gml has a quite complex schema. Is this a problem for ogr?
>>     I have tried to download all the schema files to the same folder
>>     with the same name than the file but it doesn't work.
>>
>>
>>     Here is a sample:
>>     https://docs.google.com/file/d/0BwbdYcPHdb1pOEs1eGNiZnBhMUk/edit?usp=sharing
>>
>>
>>     Thanks!
>>
>>
>>     Lauri Kajan
>>     Software Developer
>>
>>     Karttakeskus Ltd.
>>     Atomitie 2
>>     00370 Helsinki
>>     Finland
>>
>>
>>     _______________________________________________
>>     gdal-dev mailing list
>>     gdal-dev at lists.osgeo.org  <mailto:gdal-dev at lists.osgeo.org>
>>     http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>     _______________________________________________
>     gdal-dev mailing list
>     gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130528/bff6a8e7/attachment.html>


More information about the gdal-dev mailing list