[gdal-dev] Issues with WFS driver
Ari Jolma
ari.jolma at gmail.com
Sat May 25 02:54:46 PDT 2013
On 05/25/2013 12:37 PM, Even Rouault wrote:
> If you output to a regular file, the GML driver will generate a .xsd
> file with the schema alongside the GML file. If you output to
> /vsistdout/ directly, then of course it is not possible to generate
> the .xsd file. If you don't want to write on the filesystem, an
> alternative would be to output to /vsimem/ so that you can read both
> files afterwards. Another way if you want to use the .xsd generated by
> the GML driver and keep the advantage of using streaming to vsistdout,
> would be to: 1) Output to /vsimem/ , create the layer definition, but
> write 0 feature. You just fetch the .xsd that can be used for
> DescribeFeatureType 2) Output to /vsistdout/ with all the needed
> features.
so, if I understand correctly:
my $postgis = Geo::OGR::Open($Datasource);
my $postgis_layer = $postgis->Layer($Name);
my $vsi = '/vsimem/';
my $gml = Geo::OGR::Driver('GML')->Create($vsi, {
TARGET_NAMESPACE => 'http://www.opengis.net/wfs', PREFIX => 'wfs' });
my $gml_layer = $gml->CreateLayer($Name);
my $schema = $postgis_layer->GetLayerDefn;
for my $i (0..$schema->GetFieldCount-1) {
$gml_layer->CreateField($schema->GetFieldDefn($i));
}
# at this point there should be a .xsd in /vsimem/, which could/should
be used for the DescribeFeatureType request
I'll try this later. Now I'm happy with the hack.
Ari
More information about the gdal-dev
mailing list