[Community] Geometry/GML serialization
sgillies at frii.com
Wed Jul 11 22:24:55 EEST 2007
I forgot to ask: why do you need to deserialize GML? Do you intend to
implement WFS-T? In that case, you could constrain the feature types
that clients can send, and make things much simpler.
I was also just reminded that Bryan Lawrence at the BADC has some plans
for a Python GML package. Write him and ask about the status of his
project. His email can be found at
Are you familiar with Subversion? If not, I could import a source
tarball if you attach one to a new ticket in our tracker.
Eric Bréhault wrote:
> Hi Sean,
> OK, using the XSD to create a class on the fly might be a starting point.
> Then we should be able to access the attribute containing the geometry (or
> even simpler: considering I just want to compute the getFeature bounding
> box, if I just extract the bounding box from my object instance, it
> would be
> We will work on this approach.
> Regarding our work:
> - we have now a prototype offering getCapabilities, describeFeatureType and
> - there is no filtering capabilities on getFeature at the moment
> - rather than exposing all the AT schema fields as featuretype elements, we
> prefered to declare manually the list of elements that must be exposed in a
> featuretype, so you just declare the element name and its type (maybe we
> will also manage other attributes, like minoccurs, maxoccurs, etc, but I am
> not sure it is really relevant), the element name may correspond to a
> field, or to a method, or whatever, as far as the targeted GeoItem is able
> to handle self.getThe_elementname(), self.the_elementname or
> we are currently working on:
> - be able to produce the feature bounding box
> - re-package and organize our prototype
> then we will start the getFeature filtering functions
> PS: by the way, can you tell me how we can have an SVN account on the
> gis-python SVN server ? (so we can publish our work)
> Eric BREHAULT
> On 7/11/07, Sean Gillies <sgillies at frii.com> wrote:
>> Eric Bréhault wrote:
>> > Hello,
>> > We are working on the Plone WFS server implementation.
>> > Each GeoItem object exposed through a feature has a geometry.
>> > To store this geometry, our first approach is to store its GML
>> > It is handy in our case because to implement the WFS getfeature method
>> > just need to find all the GeoItems (using ZCatalog) and to return their
>> > strings to produce the proper XML content.
>> > Nevertheless, we need to be able to return the feature bounding box.
>> > I have found interesting stuff in PCL/PCL-Core/cartography/geometry to
>> > get a
>> > bounding box.
>> > But I would like to know if there is an easy way to deserialize my GML
>> > strings to get Geometry objects and vice-versa, serialize a Geometry
>> > to a GML string.
>> > Thanks,
>> > Eric BREHAULT
>> Hi Eric,
>> I'm looking forward to seeing your work :)
>> I'm not aware of any complete GML package for Python. Serializing to GML
>> is one thing: you can pick a very simple form of GML and use zope page
>> templates. Deserializing any and all forms of GML would be more complex.
>> Seems to me that Python would actually support GML better than most
>> other languages. You could get a feature type's XSD, and use the
>> built-in type() function to create a corresponding class on-the-fly (I'm
>> doing this in cartography.data.postgis already). Then parse the
>> GetFeature response and create instances of that class.
>> I started down this road early last year, but with no funding I could
>> not justify completing it.
More information about the Community