Hi Laura, at a first glance it seems to be just a problem of class name
clashing between java.awt.Polygon and com.vividsolutions.geom.Polygon.
Explanation:
it seems you have an import statement for java.awt.Polygon and thus the line:
> AttributeTypeFactory.newAttributeType("the_geom", Polygon.class);
is creating a simple attribute type bound to a java.awt.Polygon instead of a
GeometryAttributeType bound to com.vividsolutions.geom.Polygon,
So I'd suggest to just change that line to
> AttributeTypeFactory.newAttributeType("the_geom",
com.vividsolutions.geom.Polygon.class);
lets see if that helps and feel free to keep asking questions as needed.
Regards,
Gabriel.
On Tuesday 08 January 2008 06:25:59 pm Laura Díaz wrote:
> Hi list,
> sorry for duplicated email, i think i posted it before to the wrong list:
>
> i am facing some problems when i try to create new polygon features out
> of a java polygon, this is my code:
>
> Feature feature = null;
> Geometry geom = null;
> geom = convertToJTSGeometry(poly, toWorld);
> try{
> AttributeType attr =
> AttributeTypeFactory.newAttributeType("the_geom", Polygon.class);
> FeatureTypeBuilder ftBuilder =
> FeatureTypeBuilder.newInstance("ez");
> ftBuilder.addType(attr);
> type = ftBuilder.getFeatureType();
> feature = type.create(new Object[]{geom});
> }
> catch(Exception e) {
> throw e;
> }
> An Exception raises in feature = type.create(new Object[]{geom});
> IllegalAttribute: java.awt.Polygon , but got
> com.vividsolutions.jts.geom.Polygon
>
> any ideas?
>
> thanks in advance,
>
> Laura
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
> !DSPAM:4045,478f5fd7178661431913854!
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users