I am trying to plot locations of some building as simple points,
the code is:

public void loadAssetData()
{
 try
 {
   AttributeType[] types = new AttributeType[1];
   types[0] = AttributeTypeFactory.newAttributeType("asset", Point.class);

   FeatureType pointType = FeatureTypeFactory.newFeatureType(types,
"pointfeature");

   GeometryFactory geomFac = new GeometryFactory();
   Point point;
   Feature feature;
   FeatureCollection fc = FeatureCollections.newCollection();

   BufferedReader bf = new BufferedReader(new
FileReader("data/chc_data2.csv"));
   float x, y;
   String s;
   String[] s1 = new String[2];
                        
   while ((s = bf.readLine()) != null)
   {
        s1 = s.split("\\s");
        x = Float.parseFloat(s1[0]);
        y = Float.parseFloat(s1[1]);
        System.out.println(x + "," + y);
        point = geomFac.createPoint(new Coordinate(x,y));
        feature = pointType.create(new Object[] { point });
        fc.add(feature);        
   }
   StyleBuilder sb = new StyleBuilder();
   Style style = sb.createStyle(sb.createPointSymbolizer());
   DefaultMapLayer layer = new DefaultMapLayer(fc, style);
   context.addLayer(layer);
  } catch (Exception e) {
    e.printStackTrace();
  }
}

where context is the MapContext previously defined for a specific CRS
and to which I also add data from a couple of georeferenced images and
from a shapefile.

It fails with the following error at each point:

Nov 15, 2006 4:48:30 PM StreamingRenderer processStylers
SEVERE: null
java.lang.NullPointerException
        at
org.geotools.renderer.lite.Decimator.decimateTransformGeneralize(Decimat
or.java:209)
        at
org.geotools.renderer.lite.Decimator.decimateTransformGeneralize(Decimat
or.java:115)
        at org.geotools.renderer.lite.LiteShape2.<init>(LiteShape2.java:132)
        at
StreamingRenderer.getTransformedShape(StreamingRenderer.java:1675)
        at StreamingRenderer.processSymbolizers(StreamingRenderer.java:1638)
        at StreamingRenderer.process(StreamingRenderer.java:1533)
        at StreamingRenderer.processStylers(StreamingRenderer.java:1475)
        at StreamingRenderer.paint(StreamingRenderer.java:544)
        at StreamingRenderer.paint(StreamingRenderer.java:406)
        at org.geotools.gui.swing.JMapPane.paintComponent(JMapPane.java:414)

Any ideas what could be wrong?
Thanx
gaby
-- 
***************************************************************
**     Gabriella Turek               [EMAIL PROTECTED]      **
** National Institute of Water & Atmospheric Research (NIWA) **
** PO Box 8602 Christchurch New Zealand +64-3-348-8987x3724  **
***************************************************************

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to