Hey we fell off the development list again - that is not cool.
Sunburned Surveyor wrote:
> This might be a little bit of a problem. OpenJUMP doesn't specify
> FeatureTypes.
Call it a FeatureCollection then. I seem to recall Jump having a
FeatureType - indeed I reviewed it as a candidate for GeoTools.
> I'll have to figure out how to work this into the conversion between
> FeatureModels.
Do you have a good (modern?) page describing the OpenJump feature model?
> I think I can just use the Layer name in OpenJUMP as the FeatureType. I
> need to talk to the other OpenJUMP developers about this. Nothing
> prevents Layers with the same
> name at the current time, so this could cause me some trouble. Let me
> check on this issue
> and I will get back to you.
No worries; the xml file just needs to known "which layer" to test. It
is not so important for the
feature by feature tests. But when you are trying to enforce constraints
between a couple of
layers it becomes more critical.
Other options (other than name) to use the filename, or URI the file,
URI of the web service etc.. We tried using URL with mixed success.
> I don't know if all of this is really necessary in my case. I was
> thinking the user would specify the two layers, and hence Feature
> collections, to be used when creating the validation.
Understood. Let me present a rough outline of how we could do this right
now .... just wrapping up the content "wrap this up" for the validation
module (as it stands now). Going into hack mode here ...warning danger.
And the type of the Feature Collection would be:
- FeatureType A = DataUtilities.createType( "a", "geom:Geometry" )
- FeatureType B DataUtilities.createType( "b", "geom:Geometry" )
You can create a couple of FeatureCollections:
- FeatureCollection featuresA = FeatureCollections.newCollection();
- FeatureCollection featuresB = FeatureCollections.newCollection();
You can then populate the featureCollection given a bunch of raw JTS
geometry from JUMP:
int id=0;
for( Geometry geom : geometryList ){
Feature aFeature = A.createFeature( "a"+(id++), new Object[]{
geom } );
featuersA.add( aFeature );
}
Wrap them up in FeatureSources (so we can query against them):
- FeatureSource sourceA = DataUtilities.source( featuresA );
- FeatureSource sourceB = DataUtilities.source( featuresB );
And then put them in a map (the key is called a "typeRef" in the
documentation):
Map map = new HashMap();
map.put( "internal:::a", sourceA );
map.put( "internal:::b", sourceB );
ValidationResults results = new DefaultFeatureResults();
validationProcessor.runIntegrityTests( null, map, null, results );
if( results.error.isEmpty() ){
System.out.println( "good!" );
else {
System.out.println( "bad!" );
}
So I was mistaken - I thought a "Registry" was needed here but
apparently it has been reduced to a Map.
If you look at ValidationProcessTest you can see another way to do
things quickly using a MemoryDataStore - in case DataUtilities.source(
featureCollection ) is too crazy.
> I had even started working on ideas for the user diaolog in Netbeans
> Matisse. I
> had envisioned a GUI that allowed the user to select 2 separate Layers
> from a drop down lists, and then select and the type of validation
> and configure it.
Understood; that xml file thing is optional right? It is just turned
into a data structure - which you can create
in code. This is how the uDig and GeoServer applications do things. They
save file out for persistence, but
at some point there is a ui.
> In our example the user would select the "Hazardous Waste Sites" layer
> in the first list, "Elemetery Schools" in the second list, and would
> select "Point must not be within distance of point." as the validation
> test. The test would be constructed with the layers selected by the
> user.
Cool - the above code outline should give your the glue code to run the
thing.
> In this case I don't think we need to use Repository or FeatureSource.
> We could use a spatial query to narrow the number of geometries to be
> searched. Is that what you are talking about?
FeatureSource is how we make the spatial query available to the
ValidationProcessor. In the code outline you can see a Map of
FeatureSource being constructed; some of the validation tests will
construct and make spatial queries on their own etc...
Cheers,
Jody
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel