hi, i am just new to geotools and needed to add a layer to a map content containing a curve i created. but everytime i run the java application, i got the following exception:
=================== Mar 06, 2013 1:34:10 PM org.geotools.renderer.lite.StreamingRenderer fireErrorEvent SEVERE: Could not find 'the_geom' in the FeatureType (http://www.opengis.net/gml:test), available attributes are: [LineString] org.geotools.filter.IllegalFilterException: Could not find 'the_geom' in the FeatureType (http://www.opengis.net/gml:test), available attributes are: [LineString] at org.geotools.renderer.lite.StreamingRenderer.checkAttributeExistence(StreamingRe nderer.java:2115) at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.ja va:2022) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:829) at org.geotools.swing.RenderingTask.call(RenderingTask.java:106) at org.geotools.swing.RenderingTask.call(RenderingTask.java:41) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) =================== using the following code snippet from http://docs.geotools.org/latest/userguide/library/jts/geometry.html, i created the "curve" ==================== private Geometry createBezierCurve(Coordinate start, Coordinate end, Coordinate ctrlPoint1, Coordinate ctrlPoint2, double smooth) { Shape curve = new CubicCurve2D.Double( start.x, start.y, ctrlPoint1.x, ctrlPoint1.y, ctrlPoint2.x, ctrlPoint2.y, end.x, end.y); // the value of the smooth arg determines how closely the line // segments between points approximate the smooth curve // (see javadocs for Shape.getPathIterator method) PathIterator iter = curve.getPathIterator(null, smooth); // a length 6 array is required for the iterator double[] iterBuf = new double[6]; List<Coordinate> coords = new ArrayList<Coordinate>(); while (!iter.isDone()) { iter.currentSegment(iterBuf); coords.add(new Coordinate(iterBuf[0], iterBuf[1])); iter.next(); } GeometryFactory gf = new GeometryFactory(); return gf.createLineString(coords.toArray(new Coordinate[coords.size()])); } ==================== did the following to add the curve (defined earlier) to a layer which subsequently will be added to the Mapcontent: ===================== Geometry curve = createBezierCurve(start, end, ctrlPoint1, ctrlPoint2, smooth); CoordinateReferenceSystem crs1 = CRS.decode("EPSG:3414"); SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName( "test" ); b.add("LineString", LineString.class, crs1); SimpleFeatureType TYPE = b.buildFeatureType(); SimpleFeatureBuilder fBuilder = new SimpleFeatureBuilder(TYPE); DefaultFeatureCollection collection = new DefaultFeatureCollection(null, null); fBuilder.add(curve); collection.add(fBuilder.buildFeature("fid.0")); ... Style style = <defined layer style> Layer curveLayer = new FeatureLayer(collection, style); MapContent map = new MapContent(); <added layers> map.addLayer(curveLayer); ===================== i would appreciate if someone could shed light if i am doing this right (defining the curve and adding the curve to a layer). i couldnt find much help online (i may have not typed in the right search criteria) using Geotools 8.7, JRE 7, eclipse Indigo... thanks! ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
