Frank Gasdorf wrote: > Hello, > > I?m currently using the MemoryFeatureCollection to show in memory features on > map but I have some problems adding an empty layer to mapContext. Hi Frank; you are certaintly at the edge of what is expected of MemoryFeatureCollection and MemoryDataStore (or the default feature collection implementation). The implementation is not very smart; often taking the first feature out of the collection and asking for its FeatureType for example.
What I would like to see is a series of memory feature collection implementations that are targeted at different needs. > I don't know whether it should be a feature or if it is a bug. I created a > FeatureType and then a MemoryFeatureCollection for that. I?m using GeoTools > version 2.5.2 and its swing components. After adding the layer to map I got > exceptions: > > First (creating a MapLayer using the FeatureCollection): > > ... > > I guess the main problem is the DefaultFeatureType.EMPTY creation in > CollectionDataStore. > > Second (creating a MapLayer using the DataStore): > I tried creating a MemoryDataStore with called the createSchema Method to get > an empty layer to map. BUT if using the ?zoom to layer? method in layer entry > in Table of Contents an other exception was thrown: > > I guess the MemoryDataStore getBounds(Query query) should have a behaviour > like in CollectionDataStore getBoundsInternal : > > ReferencedEnvelope envelope = new ReferencedEnvelope( > featureType.getCoordinateReferenceSystem() ); > > If the FeatureType is well defined it would work very well except creating a > MapLayer like described above. > It looks like some of the problems you are turning up have more to do with testing a boundary condition (ie what to do when there are no contents) then anything else. > Thank you for any advice. Does anybody use the kind of Collections / > DataStores ? Should a create a ticket in JIRA? > If you would like to report these as bugs (and please check to see if they are reported already) I would be happy to review any patches you can provide. Things like your ReferencedEnvelope suggestion should be easy to do; however we should check the API contract and see what is expected of an empty collection; perhaps we have a chance to improve the javadocs here. Thanks for the report :-) Jody ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
