Hello Jody

I forgot to say that I do get a "SRID could not be determined" warning 
message when creating a schema.

Tracking things down a little, I saw that the method 
PostgisDataStore.createSchema does attempt to setup a valid SRID.. but 
it fails!

If anyone is familiar with this class, it would be nice to take a look 
at lines of code 1287-1298 at PostgisDataStore.java (this is 2.5-M3):

try {
     Set ident = refSys.getIdentifiers();
     if ((ident == null || ident.isEmpty()) && refSys == 
DefaultGeographicCRS.WGS84) {
         SRID = 4326;
     } else {
         String code = ((NamedIdentifier) ident.toArray()[0]).getCode();
         SRID = Integer.parseInt(code);
     }
} catch (Exception e) {
     LOGGER.warning("SRID could not be determined");
     SRID = -1;
}

It ends up that getIdentifiers() returns an empty set, but the 
comparison with DefaultGeographicCRS.WGS84 fails (as I guess it should 
since this isn't the default WGS84 but rather one read from the 
shapefile's .prj file)

I should say that this is also happening for other CRSs besides WGS84 
(i.e., other shapefiles with distinct .prj files)

I guess this points to the main issue here: for me, the SRID code should 
be looked up with CRS.lookupEpsgCode. Shouldn't it be used in this case? 
I tested it and it retrieved the correct code for the shapefile's CRS 
(using fullScan=true). However, I didn't change PostgisDataStore to test 
if that is enough to make everything work, but I can't see why not.

Cheers,
Milton


Jody Garnett wrote:
> GeoTools is supposed to look up the definitions in your spatial_ref_sys 
> table; and use them. I believe Andrea was having similar questions about 
> creating Geometry to update a postgis table...
> 
> When you copy your geometry over can you try calling setSRID( 4326 ) on 
> each geometry - and see if that makes a difference? It would be nice if 
> the DataStore did this work for you - but I doubt it is that smart.
> 
> Jody
> 

-- 

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3527-2502

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to