Comments:

Instead of the name attribute, I would just use <name> instead of the <featureCollection> tag. GML allows this, and the parser can easily decide that the first element seen is the name of the dataset. See the attached...

Ditto for the feature type attribute. Define that the elements nested below the featureCollection element are features, and then the actual element name can be used as the type, if required. This exactly what you do in GML.

The key point here is that the element nesting structure is fixed, so that no schema is needed to understand it. The actual element names can then be used to carry further information.

We should also add srsIds to geometry elements.

And yes, definitely lots of code could be reused from the existing parser. Although, I would also like to look into the performance of a parser which was NOT a full XML parser, but optimized for this exact format. One reason for constraining the line layout of the file is to make it much simpler to parse by a simple line-oriented state machine. (I would severely constrain the layout of the geometry representation, for instance).

Sunburned Surveyor wrote:
Martin,

I have made some small modifications to your sample SGF (Simple GML
Format?) file.

My changes were as follows:

- I added a "name" attribute to the start tag of the featureCollection
element. This would allow an SGF file to contain multiple
featureCollection elements. OpenJUMP or the parsing program could then
create a layer for each FeatureCollection in the file. For example,
OpenJUMP would create a layer named "Cities" to contain the city
Features.

- I added FID and GID attributes.

- I added a "type" attribute to the feature element. This would allow
OpenJUMP or the parsing program to validate the content of the feature
using an external schema or other external data. (This wouldn't be
required, but at least if we identify the type of feature with an
attribute it would be an option.)

What do you think?

The Sunburned Surveyor

P.S. - Do you think it would be possible to steal code from the
existing GML parser in OpenJUMP/JUMP that creates JTS geometry objects
from <gml:Geometry> elements?
------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
------------------------------------------------------------------------

_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

<?xml version='1.0' encoding='UTF-8'?>
<sgfDoc xmlns:gml="http://www.opengis.net/gml"; xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"; >

<cities>

<city fid="200354"> 
  <geometry gid="102216">
                <gml:Point>
                  <gml:coordinates>1008983.125,455516.906,0.0 </gml:coordinates>
                </gml:Point>
  </geometry>
  <fcode type="string">AR08750000</fcode>
  <name type="string">Tofino</name>
  <pop2000 type="int">1540</pop2000>
</city>

<city fid="200355" type="City"> 
  <geometry gid="102217">
                <gml:Point>
                  <gml:coordinates>1024338.125,1028831.0,0.0 </gml:coordinates>
                </gml:Point>
  </geometry>
  <fcode>AR08750000</fcode>
  <name>Victoria</name>
  <pop2000>350000</pop2000>
</city>

<city fid="200356" type="City"> 
  <geometry gid="102218">
                <gml:Point>
                  <gml:coordinates>1281937.875,642687.563,0.0 </gml:coordinates>
                </gml:Point>
  </geometry>
  <fcode>AR08750000</fcode>
  <name>Vancouver</name>
  <pop2000>2000000</pop2000>
</city>

</cities>
</sgfDoc>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to