[udig-devel] Re: creating a temporary layer and crs
Jesse Eichar
jeichar.w at gmail.com
Thu May 15 01:10:09 PDT 2008
Sorry never seen this error before. That is really odd... it works
if you use Create Layer? Also what is the schema like? Can you show
me it?
Jesse
On 15-May-08, at 10:01 AM, andrea antonello wrote:
> Alright guy, now I got you! Thanks for that help.
>
> So I now finally create the feature type with the crs info.
>
> But then when adding my featurecollection to the tmp-datastore, I get
> an exception:
> org.geotools.data.DataSourceException: Unable to add additional
> Features of problemslayer
> at org.geotools.data.memory.MemoryDataStore
> $2.next(MemoryDataStore.java:405)
> at org.geotools.data.InProcessLockingManager
> $1.next(InProcessLockingManager.java:312)
> at
> org
> .geotools
> .data.AbstractFeatureStore.addFeatures(AbstractFeatureStore.java:251)
> at
> eu
> .hydrologis
> .jgrass
> .libs
> .utils
> .features
> .FeatureUtilities.featureCollectionToTempLayer(FeatureUtilities.java:
> 1271)
> ...
>
> which before used to work:
>
> IGeoResource resource =
> CatalogPlugin.getDefault().getLocalCatalog()
> .createTemporaryResource(fet.getSchema());
> try {
>
> FeatureStore fStore = resource.resolve(FeatureStore.class,
> new NullProgressMonitor());
> fStore.addFeatures(fet);
> } catch (IOException e) {
> e.printStackTrace();
> }
>
> Any idea?
>
> Andrea
>
>
>
>
>
> On Thu, May 15, 2008 at 9:27 AM, Jesse Eichar <jeichar.w at gmail.com>
> wrote:
>> No setter is correct. You have to recreate the geometry. I think the
>> FeatureTypeBuilder can take a FeatureType and then you can change the
>> attributesTypes of the feature type then do a createFeatureType or
>> some
>> such.
>>
>> Jesse
>> On 14-May-08, at 5:16 PM, andrea antonello wrote:
>>
>>>> I don't mean the geometry. I meant the GeometryAttribute instance
>>>> obtained
>>>> from the FeatureType. ft.getDefaultGeometry() for example
>>>
>>> Ups, sorry, didn't get that right.
>>>
>>> However ft.getDefaultGeometry() gives me a Geometry, therefore, I
>>> have the same problem.
>>>
>>> Instead the geometryattribute has only a getCoordinateSystem(),
>>> which
>>> is told to be out of date in the docs. No setter though.
>>>
>>> Andrea
>>>
>>>
>>>>
>>>> Jesse
>>>>
>>>>
>>>>
>>>> On 14-May-08, at 3:59 PM, andrea antonello wrote:
>>>>
>>>>
>>>>> Thanks for the answers guys.
>>>>>
>>>>> Jody: I need to define the crs also for the temporary layer, which
>>>>> doesn't back up on a ShapefileDataStore. My coordinates are
>>>>> drawn as
>>>>> if they were epsg:4326, but using my coordinates metric UTM.
>>>>>
>>>>> Jesse: that is a news for me, I didn't this that Geometry JTS
>>>>> should
>>>>> knkow about projections, since it is "just" a geometry engine.
>>>>> Hmmm, I
>>>>> see a setSRID(int srid), which I imagine to be the thing I
>>>>> should do,
>>>>> but what is srid? The epsg code? The doc says the id of the
>>>>> spatial
>>>>> reference system.
>>>>>
>>>>>
>>>>> Andrea
>>>>>
>>>>>
>>>>> On Wed, May 14, 2008 at 1:15 AM, Jody Garnett <jgarnett at refractions.net
>>>>> >
>>>>
>>>> wrote:
>>>>>
>>>>>> Can you "force" the projection in the ShapefileDataStore when
>>>>>> you are
>>>>>> creating it?
>>>>>>
>>>>>> Jody
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Huh, I found were I already heard about it :)
>>>>>>>
>>>>>>> http://jira.codehaus.org/browse/UDIG-970
>>>>>>>
>>>>>>> Any news about this?
>>>>>>>
>>>>>>> Andrea
>>>>>>>
>>>>>>>
>>>>>>> On Mon, May 12, 2008 at 11:53 AM, andrea antonello
>>>>>>> <andrea.antonello at gmail.com> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hi, I think I had this problem before, but not on temporary
>>>>>>>> layers.
>>>>>>>> I am creating one with:
>>>>>>>>
>>>>>>>> IGeoResource resource =
>>>>>>>>
>>>>>>>
>>>>>> CatalogPlugin.getDefault().getLocalCatalog()
>>>>>>
>>>>>>>
>>>>>>>> .createTemporaryResource(fet.getSchema());
>>>>>>>> try {
>>>>>>>>
>>>>>>>> FeatureStore fStore =
>>>>>>>> resource.resolve(FeatureStore.class,
>>>>>>>> new NullProgressMonitor());
>>>>>>>> fStore.addFeatures(fet);
>>>>>>>> } catch (IOException e) {
>>>>>>>> e.printStackTrace();
>>>>>>>> }
>>>>>>>> ApplicationGIS.addLayersToMap(ApplicationGIS.getActiveMap(),
>>>>>>>> Collections.singletonList(resource), -1);
>>>>>>>>
>>>>>>>>
>>>>>>>> But I get:
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>> org
>>>> .geotools
>>>> .referencing.operation.projection.PointOutsideEnvelopeException:
>>>>>>
>>>>>>>
>>>>>>>> Longitude 607659°34.4'E is out of range (±180°).
>>>>>>>>
>>>>>>>> since it is trying to interprete my coordinates as lat/long.
>>>>>>>> Since
>>>>
>>>> on
>>>>>>>>
>>>>>>>> a featurestore I can't force a crs, how can I solve this?
>>>>>>>>
>>>>>>>> Ciao
>>>>>>>> Andrea
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>
>>> _______________________________________________
>>> 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
>>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
More information about the udig-devel
mailing list