Hello Kapil,
Looking at the error trace, the problem is with your feature data
("java.lang.String cannot be cast to
com.vividsolutions.jts.geom.Geometry").
Your FeatureHelper class must need a little help :)
Michael
On 22 January 2013 20:28, kapil <[email protected]> wrote:
> Hi List,
>
> I want to show a map on JmapPane, but i found exception when i run the code.
> Here is my code:
>
> ResultSet res = stmt.executeQuery(sql);
> SimpleFeatureCollection col =
> org.geotools.feature.FeatureCollections.newCollection();
> while (res.next()) {
>
> col.add(PolygonFeatureHelper.createPolyFeature(new
> WKTReader().read(res.getString("the_geom")), res.getString("kide")));
> }
>
> StyleBuilder sb = new StyleBuilder();
> MapStyleSetings mapSty = new MapStyleSetings();
> //..............................
> Irrelevent code
> //
> MapContent context = new MapContent();
>
> villageLayer = new FeatureLayer(col, archStyle, "Khasra");
> System.out.println("VILLAGELAYER"+villageLayer);
>
>
> context.addLayer(villageLayer);
>
>
> mapPane.setMapContent(context);
>
>
> Jan 22, 2013 2:49:31 PM org.geotools.map.MapContent getMaxBounds
> WARNING: Unable to determine bounds of org.geotools.map.FeatureLayer[Khasra,
> VISIBLE]
> java.lang.ClassCastException: java.lang.String cannot be cast to
> com.vividsolutions.jts.geom.Geometry
> at
> org.geotools.data.collection.CollectionDataStore.getBoundsInternal(CollectionDataStore.java:164)
> at
> org.geotools.data.collection.CollectionDataStore.getBounds(CollectionDataStore.java:145)
> at
> org.geotools.data.AbstractFeatureSource.getBounds(AbstractFeatureSource.java:318)
> at
> org.geotools.data.AbstractFeatureSource.getBounds(AbstractFeatureSource.java:286)
> at org.geotools.map.FeatureLayer.getBounds(FeatureLayer.java:195)
> at org.geotools.map.MapContent.getMaxBounds(MapContent.java:600)
> at org.geotools.map.MapContent.getViewport(MapContent.java:665)
> at
> org.geotools.swing.AbstractMapPane.doSetMapContent(AbstractMapPane.java:539)
> at
> org.geotools.swing.AbstractMapPane.setMapContent(AbstractMapPane.java:517)
> at org.geotools.swing.JMapPane.setMapContent(JMapPane.java:86)
> at
> in.nic.niccg.lrc.gis.lrcmapmutation.MapFactory.drawVillageMap(MapFactory.java:167)
> at
> in.nic.niccg.lrc.gis.lrcmapmutation.VillageMap$ShowMapTask.doInBackground(VillageMap.java:292)
> at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
>
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/Problem-in-showing-Layer-on-JmapPane-tp5028912.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users