I'm sorry to reply late to your mail - I'm travelling now in Asia, and
things are quite busy.
> I've read a few of your mails and I'm going to try to provide a single
> answer to them.
thank you & thank you for taking the time to think about the questions I
> If I understand correctly, you want to parse AIXM, a GML based XML
> file, and render it on a map.
yes :) and, eventually serve the same content via WFS.
> Regardless of how you approach this, going directly from XML to map
> rendering is going to
> be, uh, gut feeling, 10-100 times slower than rendering a binary data
> source that has any
> sort of spatial indexing (e.g., shapefile).
yes, I thought so. OTOH, I figured let's start with a naiive approach,
and then optimize later by adding indexes, etc.
also, each AIXM file has a possible boundedBy element, which already
limits the spacial coverage of all data within that particular file,
thus very simple culling can be performed from the start.
> So, my first observation would be, if you have to repeatedly render
> the same file over and over,
> is there any way you can turn it into something more efficient to read?
> I don't have good suggestions on the how though.
I was thinking about this myself, but I couldn't really come up with a
proper solution myself either. the generic question basically is: is
there a good way to represent complex, geospacial data in a generic way?
I didn't yet find one.
of course I could create 'my data model' out of AIXM files, but actually
this is what I'd try to avoid, as my goal is to represent data as AIXM.
this would mean that parts of the data from SLD can be referenced
according to the AIXM data model.
> About parsing the XML, all the solutions you're looking into have some
> value, but if you have
> to render I'd stay away from generic ones and go straigth to something
> that is optimized.
> Either a hand written XML pull parser, which builds complex features
> directly, or JAXB,
> which generates a large object model that you have then to copy into
> geotools complex features.
I already have JAXB, but as you point out, it wouldn't work with
geotools 'out of the box'. actually, I didn't see how it could work at
all, for the need of re-describing the data structure in a data store in
the data store's required meta-description framework.
the problem with the hand written SAX parser is that the data model is
huge for AIXM, and would be a serious pain to have to re-code this
manually. moreover, it's bound to change, then one has to re-write it
again and again.
this is why my hope was that somehow one can work off the XML Schema
definition that's already there. or the UML definition which AIXM has
(actually they generate the XML Schema from the UML model). but from
what I see now, one can't 'convert' or 'translate' an XML Schema, or an
JAXB-generated object model, into what a geotools DataStore needs :(
> The latter has the defect that it will load the whole file in memory,
> which is not good if you are
> trying to render large amounts of AIXML, and won't allow you to do any
> filtering, whilst a hand
> written xml pull parser could also take into account the current
> filters and be smart about
> what it's loading.
yes, I'm aware of this. OTOH, the data to be handled is not that large,
should fit into a few hundred megabytes initially, so I'm not that
afraid about the memory footprint. my main obstacle currently is really
not lack of optimization, but a lack of a generic, naiive, non-optimal
> Also, with the hand written version I can imaging someone (ab)using
> the shapefile quadtree file
> (.qix) to store the bbox and offset of the first char of each
> feature, and leverage that to
> speed up spatial oriented reads (ok, this is not easy, but it's a
I'm not aware of this format, but does this handle complex types?
(unfortunately most geotools samples & code only describe simple types,
and I'm really having a hard time figuring out how complex types are
handled at all)
> As for building complex feature data stores we don't have tutorials,
> but look at the complex
> feature building code that we have in the GeoServer CSW module
> (referred to it in another
> mail sent a few minutes ago), that might serve as a template
thanks for the reference. from an initial look, it seems that a lot of
code is generated here, including the net.opengis.csw packages. what
tools where used to generate these packages?
also, maybe I'm missing something, but I don't really see GML constructs
in the CSW module - maybe this module is 'just' a set of complex
features, but does not include GML / spacial features?