Perhaps the easiest and most reliable approach for Håvard's case is
for him to write a custom DataStore which provides a uniform view of
the heterogeneous features ?

Håvard: here is a tutorial about the basic concepts:
http://docs.geotools.org/latest/userguide/tutorial/advanced/contentdatastore.html

Michael

2011/9/20 Andrea Aime <[email protected]>:
> 2011/9/19 Håvard Nesse <[email protected]>:
>> Hi!
>>
>> I'm having a hard time using the StreamingRenderer (GeoTools 2.7.2). It
>> throws an exception:
>>
>> SEVERE: Could not find 'rotation' in the FeatureType
>> (http://www.opengis.net/gml:Flag)
>> org.geotools.filter.IllegalFilterException: Could not find 'rotation' in the
>> FeatureType (http://www.opengis.net/gml:Flag)
>> at
>> org.geotools.renderer.lite.StreamingRenderer.createBBoxFilters(StreamingRenderer.java:1508)
>> at
>> org.geotools.renderer.lite.StreamingRenderer.queryLayer(StreamingRenderer.java:1005)
>> at
>> org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1919)
>> at
>> org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:773)
>> at
>> org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:581)
>>
>> To explain what I've done.
>>
>> I parse a GeoJSON string and creates a FeatureCollection from it. The
>> collection is created using the SimpleFeatureBuilder (creating
>> SimpleFeatures with a SimpleFeatureType). The type is also created by
>> looking at the properties in my GeoJSON. The style used for rendering is
>> read from an SLD file.
>>
>> The problem seems to be that StreamingRenderer throws this Exception if the
>> GeoJSON (or in this case the Feature I want to render) is missing any
>> attributes defined in the SLD.
>>
>> The part of the SLD which makes this crash and burn is:
>>
>>                  <Rule>
>>                     <ogc:Filter>
>>                         <ogc:PropertyIsEqualTo>
>>                             <ogc:PropertyName>type</ogc:PropertyName>
>>                             <ogc:Literal>arrow_end</ogc:Literal>
>>                         </ogc:PropertyIsEqualTo>
>>                     </ogc:Filter>
>>                     <PointSymbolizer>
>>                         <Graphic>
>>                             <ExternalGraphic>
>>                                 <OnlineResource xlink:type="simple"
>> xlink:href="images/arrow_end.png"/>
>>                                 <Format>image/png</Format>
>>                             </ExternalGraphic>
>>
>> <Rotation><ogc:PropertyName>rotation</ogc:PropertyName></Rotation>
>>                         </Graphic>
>>                     </PointSymbolizer>
>>                 </Rule>
>>
>> I parse and try to render the following feature:
>>
>> {"type":"FeatureCollection","features":[{"type":"Feature","id":"OpenLayers.Feature.Vector_207",
>> "properties":{"type":"pnt_pumpe"},"geometry":{"type":"Point","coordinates":[486483.61761134,6479993.5908865]}}]}
>>
>> This makes the StreamingRenderer throw this Exception and exit. Adding
>> 'rotation' to the JSON above sort of solves the problem, but the main
>> question remains:
>>
>> Why do the features sent to the StreamingRenderer have to contain every
>> property defined in the SLD (or so it seems)? The rule above doesn't even
>> apply to the feature I'm trying to render.
>
> The requirement that a property used in the SLD has to be there seems
> obvious to me,
> it's like asking why a column has to be there if it's used in a sql query.
> The GeoTools code is written so that it should work if the attribute
> is known, but its
> value is null, but does not work if you don't follow the expected structure.
> This is done primarily to inform people about typos in their SLD (a
> very common error,
> people flooded us with complaints that GeoTools/GeoServer were not working
> just because they mistyped or used the wrong case in attribute names).
>
> We don't have a way to deal with data whose structure varies between one 
> feature
> and the next at the moment.
> I guess we could add a flag to avoid those basic validity checks that are 
> making
> it throw an exception.
>
> I don't have unstructured data handy though, patches welcomed :-)
>
> Cheers
> Andrea
>
>
> --
> -------------------------------------------------------
> Ing. Andrea Aime
> GeoSolutions S.A.S.
> Tech lead
>
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
>
> phone: +39 0584 962313
> fax:      +39 0584 962313
>
> http://www.geo-solutions.it
> http://geo-solutions.blogspot.com/
> http://www.youtube.com/user/GeoSolutionsIT
> http://www.linkedin.com/in/andreaaime
> http://twitter.com/geowolf
>
> -------------------------------------------------------
>
> ------------------------------------------------------------------------------
> BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
> Learn about the latest advances in developing for the
> BlackBerry&reg; mobile platform with sessions, labs & more.
> See new tools and technologies. Register for BlackBerry&reg; DevCon today!
> http://p.sf.net/sfu/rim-devcon-copy1
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to