Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Fwd: Re: where conditions while displaying postgis table

Hey Jody,

you're right, the jts-1.10.jar was included twice in classpath. I removed one and was trying to use the jar provided by net.refractions.udig.libs. 

The distance tool tutorial also includes net.refractions.udig.libs being able to use com.vividsolutions.jts.geom.Coordinate class.

Unfortunately I'm getting a following exception:

Caused by: java.lang.ClassNotFoundException: com.vividsolutions.jts.geom.GeometryFactory

The funny part, after adding the net.refractions.udig.libs to MANIFEST.MF, the required jar appears even in "Plug-in Dependencies" of my plugin, I'm just having trouble at runtime. Pretty clueless ... do you have any suggestion? Appreciate your help!

Thanks,
Konstantin



>Wow that is strange; the only thing I can think of is that OSGi is >letting you have two copies of jts around? And it is having trouble >casting instances made under one classloader to instances made with the >other?
>
>In eclipse could you check your properties > java build path and see >what is happening?
>
>As you say this is really odd.
>
>Jody
>
>
On 27/06/2010, at 5:43 AM, konfri@xxxxxx wrote:

> Hey Jody,
> 
> thanks for your reply. I tried your first suggestion and created feature type. Unfortunately an exception is thrown:
> 
> net.refractions.udig.project.render.RenderException: Exception(s) occured during rendering: com.vividsolutions.jts.geom.Point cannot be cast to com.vividsolutions.jts.geom.Geometry
>    at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:355)
>    at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:224)
>    at net.refractions.udig.project.internal.render.impl.RenderJob.startRendering(RenderJob.java:108)
>    at net.refractions.udig.project.internal.render.impl.RenderJob.run(RenderJob.java:213)
>    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
> Caused by: java.lang.ClassCastException: com.vividsolutions.jts.geom.Point cannot be cast to com.vividsolutions.jts.geom.Geometry
>    at org.geotools.data.memory.MemoryDataStore.getBounds(MemoryDataStore.java:600)
>    at org.geotools.data.AbstractFeatureSource.getBounds(AbstractFeatureSource.java:308)
>    at org.geotools.data.AbstractFeatureSource.getBounds(AbstractFeatureSource.java:276)
>    at net.refractions.udig.catalog.memory.internal.MemoryGeoResourceImpl$ScratchResourceInfo.getBounds(MemoryGeoResourceImpl.java:155)
>    at net.refractions.udig.project.internal.impl.GeoResourceInfoInterceptor$Wrapper.getBounds(GeoResourceInfoInterceptor.java:68)
>    at net.refractions.udig.project.internal.impl.LayerImpl.obtainBoundsFromResources(LayerImpl.java:2014)
>    at net.refractions.udig.project.internal.impl.LayerImpl.getBounds(LayerImpl.java:1985)
>    at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.validateBounds(BasicFeatureRenderer.java:438)
>    at net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:253)
>    ... 4 more
> 
> The part of my source code:
> 
> FeatureCollection<SimpleFeatureType, SimpleFeature> collection = FeatureCollections
>        .newCollection();
> List<House> mcs = Util.getHouses();
> 
> SimpleFeatureType sft = null;
> {
>    SimpleFeatureType temp = DataUtilities.createType("Houses", "name:String,position:Point");
>    sft = DataUtilities.createSubType(temp, null, DefaultGeographicCRS.WGS84);
> }
> 
> int index = 0;
> for (House mc : mcs) {
>    collection.add(SimpleFeatureBuilder.build(sft,new Object[] { mc.getName(),mc.getPos() },"House" + index++));
> }
> 
> IGeoResource resource = CatalogPlugin.getDefault().getLocalCatalog().createTemporaryResource(sft);
> resource.resolve(FeatureStore.class, new NullProgressMonitor()).addFeatures(collection);
> 
> ApplicationGIS.addLayersToMap(ApplicationGIS
>        .getActiveMap(), Collections
>        .singletonList(resource), ApplicationGIS
>        .getActiveMap().getElements().size());
> 
> 
> It's a strange exceptions, since I've used a working example being able to visualize some sample points.
> 
> collection.add(SimpleFeatureBuilder.build(sft, new Object[] { wkt.read("POINT(4 4)"), "XX2" }, "name2"));
> 
> This line would produce a working layer that could be visualized by uDig. My House object already provides the position property as a point.
> 
> 
> In addition, I would like to know if the is a more straightforward way in creating feature types instead of producing strings with name and type?
> 
> Best regards,
> 
> Konstantin
> 
> 
> On 06/22/2010 01:50 AM, Jody Garnett wrote:
>> I am afraid the filter standard we use for interacting with shapefiles, postgis and web feature servers is focused just on a single where statement and does not offer joins.
>> 
>> So I will have to ask you to create a view in your database for this purpose.
>> 
>> There are two developments occurring in GeoTools that should help:
>> - app schema work allowing you to define a feature type and provide a mapping to the various tables that form its content
>> - andrea is looking at allowing sql based queries which would hopefully be similar to defining your own view
>> 
>> I have also personally created a work around (a function that does a "lookup" in another table file; I ended up loading the other file into memory to make this happen and cannot really recommend it).
>> 
>> Jody
>> 
>> On 22/06/2010, at 2:19 AM, konfri@xxxxxx wrote:
>> 
>>> Hey,
>>> 
>>> I'm having a postgis table with several columns storing the position and some meta information like the time. Now, I would like to use the meta information (can be distributed over several tables) and visualizing only certain rows. 
>>> 
>>> At present, I'm using the catalog to display the entire postgis table. Is there a way of adding additional where-conditions?
>>> 
>>> Thanks,
>>> 
>>> Kon
>>> 
>>> -- 
>>> GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.  
>>> Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
>>> _______________________________________________
>>> User-friendly Desktop Internet GIS (uDig)
>>> http://udig.refractions.net
>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>> 
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
>> 
> 
> 
> -- 
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01


Back to the top