[Zoo-discuss] service with wfs:featurecollection
Fenoy Gerald
gerald.fenoy at geolabs.fr
Thu Dec 18 07:18:25 PST 2014
Dear Steve,
as you can see in this example [1] we are using the FileFromMemBuffer function. This way, no need for storing the file before reading it.
Note that if you activate the cache in the main.cfg, then if your service code store the file again it imply the fille will be stored twice. If required, we may provide the name generated by the ZOO-Kernel at runtime for the service implementer tu directly have access to the cached file if required.
Hope this helps,
Best regards,
[1] http://zoo-project.org/trac/browser/trunk/zoo-project/zoo-services/ogr/base-vect-ops-py/cgi-env/ogr_sp.py#L35
> Le 18 déc. 2014 à 15:06, Steve.Toutant at inspq.qc.ca a écrit :
>
> Hello
> I created a python service that receives a wfs:FeatureCollection as input
> In the .cfg I have
> <ComplexData>
> <Default>
> mimeType = text/xml
> encoding = UTF-8
> schema = http://fooa/gml/3.1.0/polygon.xsd
> </Default>
> <Supported>
> mimeType = text/xml
> encoding = UTF-8
> schema = http://fooa/gml/3.1.0/polygon.xsd
> </Supported>
> </ComplexData>
>
> I would like your opinion on how I do things in my python script to make sure it is optimized because I have many other services to create
>
> First I create a temporrary file and write the result of the WFS query
> tmp_file = tempfile.NamedTemporaryFile(dir=conf["main"]["tmpPath"],prefix="zoo", delete=False)
> tmp_file.write(inputs["InputEntity1"]["value"])
> tmp_file.close()
>
> then I fetch the file to do stuff needed
> wfs_ds = ogr.Open(tmp_file.name)
> layer = wfs_ds.GetLayerByName(layername)
> feat = layer.GetNextFeature()
> while feat is not None: .....
>
>
> Is it the appropriate way to parse the WFS response?
> Many thanks
> steve
> _______________________________________________
> Zoo-discuss mailing list
> Zoo-discuss at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/zoo-discuss
>
Gérald Fenoy
http://wiki.osgeo.org/wiki/User:Djay
More information about the Zoo-discuss
mailing list