Hello every body, i have added the dependency about gt-legacy and remove the 
dependency gt-tile.
<dependency>
    <groupId>org.geotools</groupId>
    <artifactId>gt-legacy</artifactId>
    <version>2.6.3</version>
</dependency>

This is my code Java:
MapContext map=new DefaultMapContext();
      Coordinate coord1 = new Coordinate(1131270.8550,4418856.9693);
      Coordinate coord2 = new Coordinate(1131439.2747,4418792.6636);         
GeometryFactory geo=new GeometryFactory();

    AttributeType[] types = new AttributeType[1];
    LineString lines =geo.createLineString(new Coordinate[]{coord1,coord2});

    types[0] = 
org.geotools.feature.AttributeTypeFactory.newAttributeType("centerline",lines.getClass());

    org.geotools.feature.FeatureType lineType = 
org.geotools.feature.FeatureTypeFactory.newFeatureType(types,"linetype");      
org.geotools.feature.Feature linefeature = lineType.create(new Object[]{lines});

    FeatureCollection fcline=FeatureCollections.newCollection();
    fcline.add(linefeature);
map.addLayer(fcline, style);

 JMapFrame.showMap(map);


. Now i have this problem: 

Exception in thread "main" 
org.geotools.feature.IllegalAttributeException:illegal attribute:null value:null
        at 
org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:240)
        at 
org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:212)
        at com.mycompany.cartes.App.main(App.java:154)
Caused by: java.lang.ClassCastException: 
org.geotools.feature.simple.SimpleFeatureImpl cannot be cast to 
org.geotools.feature.Feature
        at 
org.geotools.feature.DefaultFeatureType.create(DefaultFeatureType.java:237)
        ... 2 more
[ERROR]The following mojo encountered an error while executing:
[ERROR]Group-Id: org.codehaus.mojo
[ERROR]Artifact-Id: exec-maven-plugin
[ERROR]Version: 1.1.1
[ERROR]Mojo: exec
[ERROR]brought in via: Direct invocation
[ERROR]While building project:
[ERROR]Group-Id: com.mycompany
[ERROR]Artifact-Id: cartes
[ERROR]Version: 1.0-SNAPSHOT
[ERROR]From file: C:\Users\Arnauld\Documents\NetBeansProjects\cartes\pom.xml
[ERROR]Reason: Result of cmd.exe /X /C ""C:\Program 
Files\Java\jdk1.6.0_02\bin\java.exe" -classpath 
C:\Users\Arnauld\Documents\NetBeansProjects\cartes\target\classes;C:\Users\Arnauld\.m2\repository\org\geotools\gt-postgis\2.6.3\gt-postgis-2.6.3.jar;C:\Users\Arnauld\.m2\repository\org\geotools\gt-jdbc\2.6.3\gt-jdbc-2.6.3.jar;C:\Users\Arnauld\.m2\repository\org\geotools\gt-api\2.6.3\gt-api-2.6.3.jar;C:\Users\Arnauld\.m2\repository\com\vividsolutions\jts\1.10\jts-1.10.jar;
 is: '1'.
------------------------------------------------------------------------
For more information, run with the -e flag
------------------------------------------------------------------------
BUILD FAILED

The red line is where the running generate the exception
.Thank you for your help.I don't know how to solve this problem


      
------------------------------------------------------------------------------

_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to