[geotk] Issue with JAXPFeatureTypeReader

johann sorel johann.sorel at geomatys.com
Wed Jul 1 01:03:03 PDT 2015


Hello

I think all your problems comes from using both opengis and geotk 
feature models.
Until the work is finished you should not mixed them and use the geotk 
model.

in your file :
https://github.com/openfigis/gems/blob/master/feature/src/main/java/org/fao/fi/gems/feature/FeatureUtils.java#L55

Change : PropertyType prop : feature.getType().getProperties(false);
to : PropertyDescriptor desc : feature.getType().getDescriptors();
...
if(desc.getType() instanceof GeometryType){
...

Or you can use the shortcut : 
feature.getType().getGeometryDescriptor().getName()

You must know that PropertyDescriptor name is not the same as 
PropertyType name.
(PropertyDescriptor do not exist in opengis model, that's why we can't 
fully implement the opengis model in geotk)


You will have to change the imports too,
Change : org.opengis.feature.*;
to : org.geotoolkit.feature.*;

Also for the name ou can use : desc.getName().tip().toString();
This will give you the string "THE_GEOM"
Or you can keep a GenericName object instead of the string.
feature.getProperty(name).getValue();


regards


Johann Sorel
johann.sorel at geomatys.com



On 30/06/2015 14:41, Emmanuel Blondel wrote:
> See  below my answer (sorry it seems the email was blocked because of 
> the size).
>
> Thanks in advance if you can help me
> Emmanuel
>
> Le 29/06/2015 23:13, Emmanuel Blondel a écrit :
>> Thanks for your reply,
>>
>> Actually your answer let met wondering if i am using the correct 
>> dependencies now that i have switched to ApacheSIS 0.6-jdk7-snapshot.
>> I am using it in combination wih Geotk 4.0-snapshot, an i use some 
>> basic WFS client built on the following minimal set of deps:
>>
>>         <!-- Geotk -->
>>         <dependency>
>>             <groupId>org.geotoolkit</groupId>
>>             <artifactId>geotk-xml-wfs</artifactId>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.geotoolkit</groupId>
>>             <artifactId>geotk-jaxp-core</artifactId>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.geotoolkit</groupId>
>>             <artifactId>geotk-jaxp-gml</artifactId>
>>         </dependency>
>>         <dependency>
>>             <groupId>org.geotoolkit</groupId>
>>             <artifactId>geotk-feature</artifactId>
>>         </dependency>
>>
>> Should i move to some Apache SIS deps instead of the above?
>> With the above deps, i have access through Geotoolkit to the 
>> "getProperties(true)" method, but i don't have any 
>> "/getDescriptors()"/ available.
>>
>> For what concerns your first questions, see below:
>>
>> * Output for /feature.toString()/
>>
>> DefaultFeature http://www.fao.org/vme:VMEMEASURES_TIME 
>> type=http://www.fao.org/vme:VMEMEASURES_TIME
>> ╓──────────────────────────────────────────┬──────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────╖
>> ║ name                                     │ 
>> id                                               │ value ║
>> ╟──────────────────────────────────────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────╢
>> ║ {http://www.fao.org/vme}VMEMEASURES_TIME │ 
>> VMEMEASURES_TIME.fid--550a6b6d_14e31e07ee8_-7aa7 │ ║
>> ║   ├─{http://www.opengis.net/gml}@fid 
>> │                                                  │ 
>> VMEMEASURES_TIME.fid--550a6b6d_14e31e07ee8_-7aa7 ║
>> ║   ├─{http://www.fao.org/vme}FID 
>> │                                                  │ 40 ║
>> ║   ├─{http://www.fao.org/vme}THE_GEOM 
>> │                                                  │ POLYGON 
>> ((-15.7458 59.3495, -16.766 59.7115, -17.0276 59.4485, -17.256 
>> 59.3629, -17.5203 59.4029, -1 ... ║
>> ║   ├─{http://www.fao.org/vme}VME_ID 
>> │                                                  │ VME_NEAFC_1 ║
>> ║   ├─{http://www.fao.org/vme}OWNER 
>> │                                                  │ NEAFC ║
>> ║   ├─{http://www.fao.org/vme}START_YEAR 
>> │                                                  │ Fri Jan 01 
>> 00:00:00 CET 2010 ║
>> ║   ├─{http://www.fao.org/vme}END_YEAR 
>> │                                                  │ Fri Dec 31 
>> 00:00:00 CET 2010 ║
>> ║   ├─{http://www.fao.org/vme}LOCAL_NAME 
>> │                                                  │ Hatton Bank ║
>> ║   ├─{http://www.fao.org/vme}GLOB_TYPE 
>> │                                                  │ VME ║
>> ║   ├─{http://www.fao.org/vme}GLOB_NAME 
>> │                                                  │ VME Closed Areas ║
>> ║   ├─{http://www.fao.org/vme}REG_TYPE 
>> │                                                  │ CLOS_VME ║
>> ║   ├─{http://www.fao.org/vme}REG_NAME 
>> │                                                  │ VME closure ║
>> ║   ├─{http://www.fao.org/vme}STYLE 
>> │                                                  │ 1 ║
>> ║   ├─{http://www.fao.org/vme}SHAPE_AREA 
>> │                                                  │ 2.43705165805 ║
>> ║   └─{http://www.fao.org/vme}SURFACE 
>> │                                                  │ 1.56415911706E10 ║
>> ╙──────────────────────────────────────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────╜
>>
>>
>> * Output for /feature.getType().toString()/
>>
>> ModifiableFeaturetype http://www.fao.org/vme:VMEMEASURES_TIME identified
>> ╓────────────────────────────────────┬──────┬──────┬───────────┬────────────┬──────┬───────────╖
>> ║ name                               │  min │  max │  nillable │  
>> type      │  CRS │  UserData ║
>> ╟────────────────────────────────────┼──────┼──────┼───────────┼────────────┼──────┼───────────╢
>> ║ {http://www.opengis.net/gml}@fid │ 0    │ 1    │ false     │ 
>> String     │      │           ║
>> ║ {http://www.fao.org/vme}FID │ 1    │ 1    │ false     │ BigDecimal 
>> │      │           ║
>> ║ {http://www.fao.org/vme}THE_GEOM │ 0    │ 1    │ true      │ 
>> Geometry   │      │           ║
>> ║ {http://www.fao.org/vme}VME_ID │ 0    │ 1    │ true      │ 
>> String     │      │           ║
>> ║ {http://www.fao.org/vme}OWNER │ 0    │ 1    │ true      │ 
>> String     │      │           ║
>> ║ {http://www.fao.org/vme}START_YEAR │ 0    │ 1    │ true      │ 
>> Date       │      │           ║
>> ║ {http://www.fao.org/vme}END_YEAR │ 0    │ 1    │ true      │ 
>> Date       │      │           ║
>> ║ {http://www.fao.org/vme}LOCAL_NAME │ 0    │ 1    │ true      │ 
>> String     │      │           ║
>> ║ {http://www.fao.org/vme}GLOB_TYPE │ 0    │ 1    │ true      │ 
>> String     │      │           ║
>> ║ {http://www.fao.org/vme}GLOB_NAME │ 0    │ 1    │ true      │ 
>> String     │      │           ║
>> ║ {http://www.fao.org/vme}REG_TYPE │ 0    │ 1    │ true      │ 
>> String     │      │           ║
>> ║ {http://www.fao.org/vme}REG_NAME │ 0    │ 1    │ true      │ 
>> String     │      │           ║
>> ║ {http://www.fao.org/vme}STYLE │ 0    │ 1    │ true      │ 
>> BigDecimal │      │           ║
>> ║ {http://www.fao.org/vme}SHAPE_AREA │ 0    │ 1    │ true      │ 
>> Double     │      │           ║
>> ║ {http://www.fao.org/vme}SURFACE │ 0    │ 1    │ true      │ 
>> Double     │      │           ║
>> ╙────────────────────────────────────┴──────┴──────┴───────────┴────────────┴──────┴───────────╜
>> crs null
>>
>> Le 29/06/2015 09:49, johann sorel a écrit :
>>> Hello emmanuel,
>>>
>>> Could you send the result of :
>>> feature.getType().toString()
>>> and
>>> feature.toString();
>>>
>>>
>>> The method : /feature.getType().*getProperties(true)*/
>>> is from the new feature model of SIS and geotk implementation do not 
>>> fully comply with those interfaces yet.
>>> use : feature.getType().*getDescriptors()*
>
>
>
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20150701/db30dc64/attachment-0001.html>


More information about the Geotoolkit mailing list