Unfortunately I have run into this issue in a few places, and the only 
time the answer is to do a full lookup. I always to try to set fullScan 
to false, but it seems to only work some of the time. I understand the 
cost of the lookup but I see no other alternative in a case where you 
*need* an SRS code.

Can we perhaps on startup of geoserver force a full lookup and cache it 
so that we can be 100% sure that lookupEpsgCode with fullScan set to 
false will return an answer?

I could amend the code to use the WKT, but that would be a bit of a 
pain. It will also be problematic with rest, because an EPSG code is 
needed in order to get at data. Making the client parse WKT will be 
problematic.

Andrea Aime wrote:
> Hi,
> investigating why saving a feature type was taking so long
> on trunk I found out this code:
> 
> @Override
> public String toString(Object obj) {
>      CoordinateReferenceSystem crs = (CoordinateReferenceSystem) obj;
>      try {
>          return "EPSG:" + CRS.lookupEpsgCode(crs, true);
>      }
>      catch (FactoryException e) {
>          XStreamPersister.LOGGER.warning( "Could not determine epsg code 
> of crs, encoding as WKT");
>          return crs.toWKT();
>      }
> }
> 
> Doing a full lookup can take a whole lot of time, can't we
> use lookupEpsgCode(crs, false) instead, or just save the
> wkt form? In any case we're saving the native CRS there,
> I don't believe any significant information will be lost
> if we just use the WKT form (and if the native code came
> from a EPSG id, like those coming from postgis, the
> lookupEspgCode(crs, false) will quickly catch the official
> code anyways).
> 
> Cheers
> Andrea
> 


-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to