[geotk] Need some help to work with geotoolkit-pending module

suneesh kumar suni_durg at yahoo.com
Tue Aug 25 09:01:36 EDT 2009


Hi,

Thanks for your reply. 
I have SIRD set to -1 in the table. I have a line like this in the table structure.   CONSTRAINT enforce_srid_wkb_geometry CHECK (srid(wkb_geometry) = (-1))

I have imported the data from shape file into postgis. There was no projection file with the shape file. It is shape of land plots. They have digitized by saning the paper map images. I was thinking to deal it as some Cartesian polygons. Am I doing wrong? What to do if I do not know the CRS? I just wanted to  show the images of the plots.

I am new to GIS. Please advice me.

Thank you again,

Sunish./



--- On Tue, 25/8/09, johann sorel <johann.sorel at geomatys.fr> wrote:

From: johann sorel <johann.sorel at geomatys.fr>
Subject: Re: [geotk] Need some help to work with geotoolkit-pending module
To: theunsheydenrych at gmail.com
Cc: "suneesh kumar" <suni_durg at yahoo.com>, geotoolkit at lists.osgeo.org
Date: Tuesday, 25 August, 2009, 5:23 PM

Hi,

The problems looks like the crs is not defined in your postgis database.
Check that you the have a geometry column set on your table and that it's crs is different then -1.

If it's correctly configured but you still have an error, check that your EPSG database is correctly installed.
You can make a simple test : CRS.decode("EPSG:3395");
It should return a CoordinateReferenceSystem object, if not then you have a problem with
your epsg database.

for information : MapBuilder.createContext(DefaultEngineeringCRS.CARTESIAN_2D);
The crs that you give here is not used for rendering, it is used only when you
call a getEnvelope on the MapContext.
Use setObjectiveCRS on the map canvas if you want to change the rendering projection.

johann

theuns a écrit :
> There is also a RandomStyleFactory that you can use to generate a random
> style for you just to get started.
> 
> so instead of new DefaultMutableStyle() try
> RandomStyleFactory.createRandomVectorStyle(fs) just to get you starting.
> 
> Cheers
> 
> 
> On Tue, 2009-08-25 at 14:53 +0530, suneesh kumar wrote:
>   
>> Thanks a lot for your reply. I could go ahead following your suggestion.
>> Initially I just wanted to show a map in JFrame after words I will go
>> ahead. Sorry again if I am asking some stupid question.
>> 
>> I have the following code :
>> 
>>  JMap2D mapWidget;
>>             MapContext context =
>> MapBuilder.createContext(DefaultEngineeringCRS.CARTESIAN_2D);
>>             setTitle("Test Frame");
>>             mapWidget = new JMap2D();
>>             mapWidget.getContainer().setContext(context);
>> 
>> mapWidget.getCanvas().setRenderingHint(GO2Hints.KEY_MULTI_THREAD,
>> GO2Hints.MULTI_THREAD_OFF);
>> 
>> mapWidget.getCanvas().setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
>> 
>> mapWidget.getCanvas().getController().setAutoRepaint(true);
>>             add(mapWidget);
>> 
>>             java.util.Map params = new java.util.HashMap();
>> 
>>             params.put("host", "localhost");
>>             params.put("port", 5432);
>>             params.put("database", "bhunaksha_hry");
>>             params.put("user", "postgres");
>>             params.put("passwd", "postgres");
>>             JDBCDataStore ds = new
>> PostgisNGDataStoreFactory().createDataStore(params);
>> 
>>             FeatureSource fs = ds.getFeatureSource("khasramap");
>>                      context..layers().add( MapBuilder.createFeatureLayer(fs,
>> new DefaultMutableStyle()));
>> 
>> -------------------------------------------
>> 
>> But I am getting the following exception. I will be very helpful if
>> anybody can help me to figure out where I am wrong..
>> 
>> ---------------------------------------------------------------------------
>> Exception in thread "AWT-EventQueue-0"
>> java.lang.IllegalArgumentException: Illegal argument: "crs=null".
>>         at
>> org.geotoolkit.display.primitive.AbstractReferencedGraphic.<init>(AbstractReferencedGraphic.java:92)
>>         at
>> org.geotoolkit.display.primitive.AbstractReferencedGraphic2D.<init>(AbstractReferencedGraphic2D.java:138)
>>         at
>> org.geotoolkit.display2d.primitive.AbstractGraphicJ2D.<init>(AbstractGraphicJ2D.java:45)
>>         at
>> org.geotoolkit.display2d.container.stateless.AbstractLayerJ2D.<init>(AbstractLayerJ2D.java:62)
>>         at
>> org.geotoolkit.display2d.container.stateless.StatelessFeatureLayerJ2D.<init>(StatelessFeatureLayerJ2D.java:87)
>>         at
>> org.geotoolkit.display2d.container.stateless.StatelessContextJ2D.parseLayer(StatelessContextJ2D.java:159)
>>         at
>> org.geotoolkit.display2d.container.stateless.StatelessContextJ2D.access$100(StatelessContextJ2D.java:56)
>>         at
>> org.geotoolkit.display2d.container.stateless.StatelessContextJ2D
>> $1.layerChange(StatelessContextJ2D.java:74)
>>         at
>> org.geotoolkit.map.DefaultMapContext.fireLayerChange(DefaultMapContext.java:308)
>>         at org..geotoolkit.map.DefaultMapContext
>> $1.notifyAdd(DefaultMapContext.java:67)
>>         at org.geotoolkit.map.DefaultMapContext
>> $1.notifyAdd(DefaultMapContext.java:58)
>>         at
>> org.geotoolkit.util.collection.NotifiedCheckedList.add(NotifiedCheckedList..java:53)
>>         at NewJFrame.<init>(NewJFrame.java:67)
>>         at NewJFrame$1.run(NewJFrame.java:109)
>>         at
>> java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
>>         at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
>>         at
>> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread...java:269)
>>         at
>> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
>>         at
>> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
>>         at
>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
>>         at
>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
>>         at
>> java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
>> 
>> 
>> 
>> --- On Mon, 24/8/09, theuns <theunsheydenrych at gmail.com> wrote:
>>                 From: theuns <theunsheydenrych at gmail..com>
>>         Subject: Re: [geotk] Need some help to work with
>>         geotoolkit-pending module
>>         To: "suneesh kumar" <suni_durg at yahoo.com>
>>         Cc: geotoolkit at lists.osgeo.org
>>         Date: Monday, 24 August, 2009, 7:52 PM
>>                 HI Sunish
>>                 I have used the the widget for a while now.
>>         I compile the geotoolit-pending library with mvn install
>>         -Dmaven.test.skip
>>                 After a successful build i use the widget in a JFrame as
>>         follows.
>>         The code below will not necessary compile because i copied it
>>         out
>>         quickly from my current project.
>>                 The the the usage idea is there.
>>         Hope it helps.                 public class TestFrame extends javax.swing.JFrame {
>>                     //Map widget stuff
>>             private JMap2D mapWidget;
>>             private MapContext contextSA =
>>         ContextBuilder.buildSouthAfricaContext();
>>                         public TestFrame() {
>>                 setTitle("Test Frame");
>>                                 mapWidget = new JMap2D();
>>                 mapWidget.getContainer().setContext(contextSA);
>>                         mapWidget.getCanvas()..setRenderingHint(GO2Hints.KEY_MULTI_THREAD,
>>         GO2Hints.MULTI_THREAD_OFF);
>>                 mapWidget.getCanvas().setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
>>                 mapWidget.getCanvas().getController().setAutoRepaint(true);
>>                         add(mapWidget) ;
>>                         ....
>>             }
>>                     /**
>>              * @param args the command line arguments
>>              */
>>             public static void main(String args[]) {
>>                 try {
>>                 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
>>                 } catch (ClassNotFoundException ex) {
>>                 Logger.getLogger(UserOverlayFrame.class.getName()).log(Level.SEVERE,
>>         null, ex);
>>                 } catch (InstantiationException ex) {
>>                 Logger.getLogger(UserOverlayFrame.class.getName()).log(Level.SEVERE,
>>         null, ex);
>>                 } catch (IllegalAccessException ex) {
>>                 Logger.getLogger(UserOverlayFrame.class..getName()).log(Level.SEVERE,
>>         null, ex);
>>                 } catch (UnsupportedLookAndFeelException ex) {
>>                 Logger.getLogger(UserOverlayFrame.class.getName()).log(Level.SEVERE,
>>         null, ex);
>>                 }
>>                         java.awt.EventQueue.invokeLater(new Runnable() {
>>                             public void run() {
>>                         new TestFrame().setVisible(true);
>>                     }
>>                 });
>>             }
>>         }
>>                         On Mon, 2009-08-24 at 16:06 +0530, suneesh kumar wrote:
>>         > Hello,
>>         >         >  I was trying to add JMap2D to a JFrame. At some point of
>>         time I am
>>         > getting the following error. It is unable to locate
>>         FilterFactory.
>>         > Please help me in proceeding further. I compiled the pending
>>         module
>>         > using command mvn -fn install.         > Will I have to add some other dependency jars?
>>         >         > A descriptor is already registered against the name
>>         > "org.geotoolkit.SilhouetteMask" under registry mode
>>         "rendered"
>>         > Error in registry file at line number #33
>>         > A descriptor is already registered against the name
>>         > "org.geotoolkit.Mask" under registry mode "rendered"
>>         > Exception in thread "AWT-EventQueue-0"
>>         > java.lang.ExceptionInInitializerError
>>         >         at java.lang.Class..forName0(Native Method)
>>         >         at java.lang.Class.forName(Class.java:247)
>>         >         at sun.misc.Service
>>         $LazyIterator.next(Service.java:271)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryRegistry.register(FactoryRegistry.java:900)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:816)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:866)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryRegistry.getUnfilteredProviders(FactoryRegistry.java:291)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:544)
>>         >         at
>>         >
>>         org.geotoolkit.factory.DynamicFactoryRegistry.getServiceImplementation(DynamicFactoryRegistry.java:326)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryRegistry.getOrCreateServiceProvider(FactoryRegistry.java:452)
>>         >         at
>>         >
>>         org.geotoolkit.factory.DynamicFactoryRegistry.getOrCreateServiceProvider(DynamicFactoryRegistry.java:167)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:329)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryFinder.getFactory(FactoryFinder.java:236)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryFinder.getStyleFactory(FactoryFinder.java:696)
>>         >         at
>>         >
>>         org.geotoolkit.display2d.GO2Utilities.<clinit>(GO2Utilities.java:135)
>>         >         at
>>         >
>>         org.geotoolkit.display2d.container.ContextContainer2D.<clinit>(ContextContainer2D.java:73)
>>         >         at
>>         org..geotoolkit.gui.swing.go2.JMap2D.<init>(JMap2D.java:57)
>>         >         at
>>         org.geotoolkit.gui.swing.go2.JMap2D.<init>(JMap2D.java:49)
>>         >         at
>>         >
>>         geotoolkittest.GeotoolkitTestView.<init>(GeotoolkitTestView.java:54)
>>         >         at
>>         >
>>         geotoolkittest.GeotoolkitTestApp.startup(GeotoolkitTestApp.java:19)
>>         >         at org.jdesktop.application.Application
>>         > $1.run(Application.java:171)
>>         >         at
>>         >
>>         java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
>>         >         at
>>         java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
>>         >         at
>>         >
>>         java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
>>         >         at
>>         >
>>         java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
>>         >         at
>>         >
>>         java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
>>         >         at
>>         >
>>         java.awt.EventDispatchThread.pumpEvents(EventDispatchThread..java:169)
>>         >         at
>>         >
>>         java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
>>         >         at
>>         >
>>         java.awt.EventDispatchThread.run(EventDispatchThread..java:122)
>>         > Caused by: org.geotoolkit.factory.FactoryNotFoundException:
>>         No factory
>>         > of kind "FilterFactory" found.
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryRegistry.getOrCreateServiceProvider(FactoryRegistry.java:471)
>>         >         at
>>         >
>>         org.geotoolkit.factory.DynamicFactoryRegistry.getOrCreateServiceProvider(DynamicFactoryRegistry.java:167)
>>         >         at
>>         >
>>         org..geotoolkit.factory.FactoryRegistry.getServiceProvider(FactoryRegistry..java:329)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryFinder.getFactory(FactoryFinder.java:236)
>>         >         at
>>         >
>>         org.geotoolkit.factory.FactoryFinder.getFilterFactory(FactoryFinder.java:666)
>>         >         at
>>         >
>>         org.geotoolkit.style.DefaultStyleFactory.<clinit>(DefaultStyleFactory.java:107)
>>         >         ... 29 more
>>         >         >         > Thanks in advance         > Sunish Kumar
>>         >         >         >         >
>>         ______________________________________________________________________
>>         > See the Web's breaking stories, chosen by people like you.
>>         Check out
>>         > Yahoo! Buzz.
>>         > _______________________________________________
>>         > Geotoolkit mailing list
>>         > Geotoolkit at lists.osgeo.org
>>         > http://lists.osgeo.org/mailman/listinfo/geotoolkit
>>                 
>> 
>> ______________________________________________________________________
>> Love Cricket? Check out live scores, photos, video highlights and
>> more. Click here.
>>     
> 
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit
> 
>   




      Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8. http://downloads.yahoo.com/in/internetexplorer/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geotoolkit/attachments/20090825/fea3df4e/attachment-0001.html


More information about the Geotoolkit mailing list