Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/impl/FLabel.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/impl/FLabel.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/impl/FLabel.java	(revision 42464)
@@ -96,10 +96,10 @@
  * @deprecated
  */
 public class FLabel implements Cloneable {
-    
+
     private static final Logger logger = LoggerFactory.getLogger(FLabel.class);
 
-    
+
 	public final static byte LEFT_TOP = 0;
 	public final static byte LEFT_CENTER = 1;
 	public final static byte LEFT_BOTTOM = 2;
@@ -324,7 +324,7 @@
 	 * @param geom Geometry.
 	 *
 	 * @return nuevo FLabel creado.
-	 * @throws CreateGeometryException 
+	 * @throws CreateGeometryException
 	 */
 	public static FLabel createFLabel(org.gvsig.fmap.geom.Geometry geom) throws CreateGeometryException {
 		float angle;
@@ -367,10 +367,12 @@
 				return pAux;
 
 			case org.gvsig.fmap.geom.Geometry.TYPES.SURFACE:
-			    
+
 			    try {
 	                Point pLabel = geom.centroid();
-	                return new Point2D.Double(pLabel.getX(), pLabel.getY());
+	                if(pLabel!=null){
+	                    return new Point2D.Double(pLabel.getX(), pLabel.getY());
+	                }
 			    } catch (Exception ex) {
 			        logger.info("Error while computing centroid. ", ex);
 			    }
@@ -390,7 +392,7 @@
     			break;
 
 		} // switch
-				
+
 		return null;
 	}
 	public void setTypeFont(String t) {
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/AbstractVectorialLegend.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/AbstractVectorialLegend.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/AbstractVectorialLegend.java	(revision 42464)
@@ -87,15 +87,15 @@
 
 /**
  * Base implementation for Vectorial data Legends.
- * 
+ *
  * Provides a draw method implementation which loads the {@link Feature}s and
  * uses the {@link ISymbol} objects to draw the {@link Geometry} objects.
- * 
+ *
  * @author 2009- <a href="cordinyana@gvsig.org">César Ordiñana</a> - gvSIG team
  */
 public abstract class AbstractVectorialLegend extends AbstractLegend implements
 IVectorLegend {
-	
+
 	private static final Logger LOG = LoggerFactory
 			.getLogger(AbstractVectorialLegend.class);
 
@@ -123,7 +123,7 @@
         this.zSort = zSort;
         addLegendListener(zSort);
     }
-    
+
     @SuppressWarnings("unchecked")
     public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
         Cancellable cancel, double scale, Map queryParameters,
@@ -133,7 +133,7 @@
         draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
             featureStore, null, dpi);
     }
-    
+
     @SuppressWarnings("unchecked")
     public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
         Cancellable cancel, double scale, Map queryParameters,
@@ -152,7 +152,7 @@
         print(g, viewPort, cancel, scale, queryParameters, coordTrans,
             featureStore, null, properties);
     }
-    
+
     @SuppressWarnings("unchecked")
     public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
         double scale, Map queryParameters, ICoordTrans coordTrans,
@@ -178,7 +178,7 @@
 
             int mapLevelCount = (useZSort) ? zSort.getLevelCount() : 1;
             for (int mapPass = 0; mapPass < mapLevelCount; mapPass++) {
-                
+
                 Envelope vp_env_in_store_crs = null;
                 IProjection store_crs = null;
                 if (coordTrans != null) {
@@ -191,7 +191,7 @@
                     vp_env_in_store_crs = viewPort.getAdjustedEnvelope();
                     store_crs = viewPort.getProjection();
                 }
-                
+
                 FeatureQuery feat_query = fquery;
                 Envelope store_env = featureStore.getEnvelope();
                 boolean use_intersection_cond = false;
@@ -205,9 +205,9 @@
                         use_intersection_cond = true;
                     }
                 }
-                
+
                 if (use_intersection_cond) {
-                    FeatureType ft = featureStore.getDefaultFeatureType(); 
+                    FeatureType ft = featureStore.getDefaultFeatureType();
                     IntersectsEnvelopeEvaluator iee =
                         new IntersectsEnvelopeEvaluator(
                             vp_env_in_store_crs,
@@ -220,7 +220,7 @@
                     }
                     feat_query.addFilter(iee);
                 }
-                
+
                 // 'feat_query' can still be NULL here, so we only filter
                 // the featureStore if it's not null
                 if (feat_query == null) {
@@ -235,7 +235,7 @@
                     Geometry geom = feat.getDefaultGeometry();
                     if (geom==null) {
                     	continue;
-                    }                    
+                    }
                     // Reprojection if needed
                     if (coordTrans != null) {
                         geom = geom.cloneGeometry();
@@ -363,9 +363,13 @@
 		}
 
 		IProjection dataProjection;
-		Envelope reprojectedDataEnvelop;
-
+		Envelope dataEnvelope;
+		Envelope reprojectedDataEnvelope;
+		// Gets the view envelope
+		Envelope viewPortEnvelope = viewPort.getAdjustedEnvelope();
+        Envelope reprojectedViewPortEnvelope;
 		try {
+		    dataEnvelope = featureStore.getEnvelope();
 			if (coordTrans == null) {
 				dataProjection = featureStore.getDefaultFeatureType()
 						.getDefaultSRS();
@@ -376,37 +380,42 @@
 					dataProjection = viewPort.getProjection();
 				}
 
-				reprojectedDataEnvelop = featureStore.getEnvelope();
+				reprojectedDataEnvelope = dataEnvelope;
+                reprojectedViewPortEnvelope = viewPortEnvelope;
 			} else {
 				dataProjection = coordTrans.getPOrig();
 
-				Envelope env = featureStore.getEnvelope();
-				if ( env!=null && !env.isEmpty()) {
-					reprojectedDataEnvelop = env.convert(coordTrans);
+				if ( dataEnvelope!=null && !dataEnvelope.isEmpty()) {
+					reprojectedDataEnvelope = dataEnvelope.convert(coordTrans);
 				} else {
-					reprojectedDataEnvelop = env;
+					reprojectedDataEnvelope = dataEnvelope;
 				}
+                if ( viewPortEnvelope!=null && !viewPortEnvelope.isEmpty()) {
+                    reprojectedViewPortEnvelope = viewPortEnvelope.convert(coordTrans.getInverted());
+                } else {
+                    reprojectedViewPortEnvelope = viewPortEnvelope;
+                }
 			}
 		} catch (DataException e) {
 			throw new LegendDrawingException(e);
 		}
 
-		// Gets the view envelope
-		Envelope viewPortEnvelope = viewPort.getAdjustedEnvelope();
 
 		// Gets the data envelope with the viewport SRS
-		Envelope myEnvelope = reprojectedDataEnvelop;
+//		Envelope myEnvelope = reprojectedDataEnvelope;
 
 		// TODO: in some cases, the legend may need a different check to
 		// decide if the data must be drawn or not
 		// Checks if the viewport envelope intersects with the data envelope
-		if (!viewPortEnvelope.intersects(myEnvelope)) {
+		// This condition may seem redundant, but sometimes the transformations may fail and cause false negatives.
+		if (!viewPortEnvelope.intersects(reprojectedDataEnvelope) && !(reprojectedViewPortEnvelope.intersects(dataEnvelope))) {
 			// The data is not visible in the current viewport, do nothing.
 			return;
 		}
 
 		// Check if all the data is contained into the viewport envelope
-		boolean containsAll = viewPortEnvelope.contains(myEnvelope);
+        // This condition may seem redundant, but sometimes the transformations may fail and cause false negatives.
+		boolean containsAll = viewPortEnvelope.contains(reprojectedDataEnvelope) || reprojectedViewPortEnvelope.contains(dataEnvelope);
 
 		// Create the drawing notification to be reused on each iteration
 		DefaultFeatureDrawnNotification drawnNotification = new DefaultFeatureDrawnNotification();
@@ -463,13 +472,13 @@
         boolean containsAll) throws DataException {
 
         featureQuery.setScale(scale);
-        
+
         //Adds the attributes
         String[] fieldNames = getRequiredFeatureAttributeNames(featureStore);
         for (int i=0 ; i<fieldNames.length ;i++){
             featureQuery.addAttributeName(fieldNames[i]);
-        }       
-        
+        }
+
         // TODO: Mobile has it's own IntersectsEnvelopeEvaluator
         if (!containsAll) {
             // Gets the viewport envelope with the data SRS
@@ -490,7 +499,7 @@
                 featureStore.getDefaultFeatureType(), featureStore
                 .getDefaultFeatureType()
                 .getDefaultGeometryAttributeName());
-            featureQuery.addFilter(iee);			
+            featureQuery.addFilter(iee);
         }
         if (queryParameters != null) {
             Iterator iterEntry = queryParameters.entrySet().iterator();
@@ -500,7 +509,7 @@
                 featureQuery.setQueryParameter((String) entry.getKey(),
                     entry.getValue());
             }
-        }	
+        }
         return featureQuery;
     }
 
@@ -579,14 +588,17 @@
             try {
                 geom.reProject(coordTrans);
             } catch (ReprojectionRuntimeException re) {
+                LOG.warn("Can't reproject geometry "+geom.toString(), re);
+                return;
+
                 /*
                  * Library was unable to reproject
                  * See reproject method in Point2D (geometry)
                  */
-                throw new CreateGeometryException(
-                    geom.getGeometryType().getType(),
-                    geom.getGeometryType().getSubType(),
-                    re);
+//                throw new CreateGeometryException(
+//                    geom.getGeometryType().getType(),
+//                    geom.getGeometryType().getSubType(),
+//                    re);
             }
         }
 
@@ -926,7 +938,7 @@
     /**
      * Returns the names of the {@link Feature} attributes required for the
      * {@link ILegend} to operate.
-     * 
+     *
      * @param featureStore
      *            the store where the {@link Feature}s belong to
      * @return the names of required {@link Feature} attribute names
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java	(revision 42464)
@@ -24,6 +24,7 @@
 package org.gvsig.fmap.mapcontext.layers.vectorial;
 
 import org.cresques.cts.IProjection;
+
 import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
 import org.gvsig.fmap.dal.feature.Feature;
 import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
@@ -44,6 +45,7 @@
 	private Envelope envelopeTrans;
 	private boolean isDefault;
 	private String srs;
+	String defaultGeometryAttributeName;
 
 	public IntersectsEnvelopeEvaluator(Envelope envelope,
 			IProjection envelopeProjection, FeatureType featureType,
@@ -51,7 +53,8 @@
 		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
 				.get(geomName);
 
-		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+		defaultGeometryAttributeName = featureType.getDefaultGeometryAttributeName();
+        this.isDefault = defaultGeometryAttributeName.equals(
 				geomName);
 		this.envelope = envelope;
 		// this.srs = envelopeProjection.getAbrev();
@@ -74,22 +77,25 @@
 
 	}
 
-	public Object evaluate(EvaluatorData data) throws EvaluatorException {
-		Envelope featureEnvelope;
-		if (isDefault) {
-			featureEnvelope = ((Feature) data.getContextValue("feature"))
-					.getDefaultEnvelope();
-		} else {
-                    Geometry geom = (Geometry) data.getDataValue(geomName);
-                    if( geom == null ) {
-                        return Boolean.FALSE;
-                    }
-                    featureEnvelope = geom.getEnvelope();
-		}
-		return new Boolean(envelopeTrans.intersects(featureEnvelope));
+    public Object evaluate(EvaluatorData data) throws EvaluatorException {
+        Envelope featureEnvelope;
+        Geometry geom = null;
+        if (isDefault) {
+            geom = (Geometry) data.getDataValue(defaultGeometryAttributeName);
+            featureEnvelope = ((Feature) data.getContextValue("feature")).getDefaultEnvelope();
+        } else {
+            geom = (Geometry) data.getDataValue(geomName);
+            if (geom == null) {
+                return Boolean.FALSE;
+            }
+            featureEnvelope = geom.getEnvelope();
+        }
+        if (envelopeTrans.intersects(featureEnvelope)) {
+            return new Boolean(envelopeTrans.intersects(geom));
+        }
+        return Boolean.FALSE;
+    }
 
-	}
-
 	public String getName() {
 		return "intersects envelope";
 	}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/ProjectionPool.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/ProjectionPool.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/ProjectionPool.java	(revision 42464)
@@ -222,7 +222,7 @@
         cs = new CSLambertCC(CSDatum.ntfParis, 0, 46.79999999999995, 0.99987742, 600000, 2200000);
         cs.setAbrev("EPSG:27572");
         data.put(cs.getAbrev(), cs);
-        
+
         cs = new CSLambertCC(CSDatum.ntfParis, 0, 52, 0.99987742, 600000, 2200000);
         cs.setAbrev("EPSG:27582");
         data.put(cs.getAbrev(), cs);
@@ -248,7 +248,7 @@
         data.put(cs.getAbrev(), cs);
         cs.setAbrev("EPSG:9804");
         data.put(cs.getAbrev(), cs);
-        
+
         // Lo que faltaba: ¡planetas!
         cs = (new CSUTM(CSDatum.moon, 30)).toGeo();
         cs.setAbrev("IAU2000:30100"); // Moon
@@ -257,22 +257,22 @@
         cs = (new CSUTM(CSDatum.mars, 30)).toGeo();
         cs.setAbrev("IAU2000:49900"); // Mars
         data.put(cs.getAbrev(), cs);
-        
+
         /*
          * CRSs argentinos.
          * coordenadas geograficas
-			PosGAr 4172 
+			PosGAr 4172
 			PosGAr98 4190
-			
+
 			coordenadas proyectadas
-			POSGAR 94/Argentina 1 22191 
+			POSGAR 94/Argentina 1 22191
 			POSGAR 94/Argentina 2 22192
 			POSGAR 94/Argentina 3 22193
 			POSGAR 94/Argentina 4 22194
 			POSGAR 94/Argentina 5 22195
 			POSGAR 94/Argentina 6 22196
 			POSGAR 94/Argentina 7 22197
-			
+
 			POSGAR 98/Argentina 1 22181
 			POSGAR 98/Argentina 2 22182
 			POSGAR 98/Argentina 3 22183
@@ -280,9 +280,9 @@
 			POSGAR 98/Argentina 5 22185
 			POSGAR 98/Argentina 6 22186
 			POSGAR 98/Argentina 7 22187
-			
+
 			4221 GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
-			
+
 			22191	EPSG	22191	PROJCS["Argentina_Zone_1",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",1500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-72],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-72 +k=1.000000 +x_0=1500000 +y_0=0 +ellps=intl +units=m
 			22192	EPSG	22192	PROJCS["Argentina_Zone_2",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",2500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-69],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-69 +k=1.000000 +x_0=2500000 +y_0=0 +ellps=intl +units=m
 			22193	EPSG	22193	PROJCS["Argentina_Zone_3",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",3500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-66],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-66 +k=1.000000 +x_0=3500000 +y_0=0 +ellps=intl +units=m
@@ -295,7 +295,7 @@
         cs = new CoordSys(CSDatum.posgar);
         cs.setAbrev("EPSG:4172"); // Posgar
         data.put(cs.getAbrev(), cs);
-        
+
         cs = new CoordSys(
 			"GEOGCS[\"GCS_Campo_Inchauspe\"," +
 				"DATUM[\"D_Campo_Inchauspe\"," +
@@ -305,7 +305,7 @@
 				"UNIT[\"Degree\",0.017453292519943295]]");
         cs.setAbrev("EPSG:4221"); // Campo Inchauspe
         data.put(cs.getAbrev(), cs);
-        
+
        for (int i=1; i<=7; i++) {
 	        cs = new CoordSys(
 	        	"PROJCS[\"Argentina_Zone_"+i+"\"," +
@@ -325,10 +325,10 @@
 	        cs.setAbrev("EPSG:2219"+i); // Posgar
 	        data.put(cs.getAbrev(), cs);
         }
-       
+
        /*
         * pendiente de añadir:
-        * 
+        *
         * EPSG 3003: Montemario / Italy Zone 1 - Pendiente de añadir
       	* EPSG 4149: CH1903 - Pendiente de añadir
       	* Ecuador:
@@ -381,4 +381,13 @@
 	public boolean doesRigurousTransformations() {
 		return false;
 	}
+
+    /* (non-Javadoc)
+     * @see org.cresques.cts.ICRSFactory#get(java.lang.String, java.lang.String)
+     */
+    @Override
+    public IProjection get(String format, String value) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/gt2/CoordSys.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/gt2/CoordSys.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/gt2/CoordSys.java	(revision 42464)
@@ -36,10 +36,11 @@
 import org.geotools.cs.CoordinateSystemFactory;
 import org.geotools.cs.GeographicCoordinateSystem;
 import org.geotools.cs.ProjectedCoordinateSystem;
-import org.gvsig.fmap.crs.CRSFactory;
 import org.opengis.referencing.FactoryException;
 
+import org.gvsig.fmap.crs.CRSFactory;
 
+
 /**
  * Sistema de Coordenadas (Proyección).
  * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
@@ -219,9 +220,18 @@
 	public String getFullCode() {
 		return getAbrev();
 	}
-	
+
 	public Object clone() throws CloneNotSupportedException {
 	       return CRSFactory.getCRS( this.getFullCode() );
 	    }
 
+    /* (non-Javadoc)
+     * @see org.cresques.cts.IProjection#export(java.lang.String)
+     */
+    @Override
+    public String export(String format) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/geo/Mercator.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/geo/Mercator.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/geo/Mercator.java	(revision 42464)
@@ -27,7 +27,6 @@
 import org.cresques.cts.IDatum;
 import org.cresques.cts.IProjection;
 import org.cresques.geo.ViewPortData;
-
 import org.cresques.px.Extent;
 
 import java.awt.FontMetrics;
@@ -35,7 +34,6 @@
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
-
 import java.util.TreeMap;
 
 
@@ -390,4 +388,13 @@
 	public String getFullCode() {
 		return getAbrev();
 	}
+
+    /* (non-Javadoc)
+     * @see org.cresques.cts.IProjection#export(java.lang.String)
+     */
+    @Override
+    public String export(String arg0) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/geo/Projection.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/geo/Projection.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/geo/Projection.java	(revision 42464)
@@ -26,6 +26,7 @@
 import org.cresques.cts.IDatum;
 import org.cresques.cts.IProjection;
 import org.cresques.geo.ViewPortData;
+
 import org.gvsig.fmap.crs.CRSFactory;
 
 import java.awt.Color;
@@ -162,13 +163,21 @@
     }
 
     abstract public void drawGrid(Graphics2D g, ViewPortData vp);
-    
+
     public boolean isProjected() {
     	return false;
     }
-    
+
     public Object clone() throws CloneNotSupportedException {
         return CRSFactory.getCRS( this.getFullCode() );
      }
 
+    /* (non-Javadoc)
+     * @see org.cresques.cts.IProjection#export(java.lang.String)
+     */
+    @Override
+    public String export(String format) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline2DM.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline2DM.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline2DM.java	(revision 42464)
@@ -24,6 +24,8 @@
 
 import com.vividsolutions.jts.geom.Coordinate;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline2DM;
 import org.gvsig.fmap.geom.jts.util.JTSUtils;
@@ -154,4 +156,15 @@
     public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
         return JTSUtils.createGeometry(getJTS().buffer(distance));
     }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans)
+     */
+    @Override
+    public void reProject(ICoordTrans ct) {
+        super.reProject(ct);
+        if (coordinates.size()>=2 && !isClosed()) {
+            closePrimitive();
+        }
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline3DM.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline3DM.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline3DM.java	(revision 42464)
@@ -24,6 +24,8 @@
 
 import com.vividsolutions.jts.geom.Coordinate;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline3DM;
 import org.gvsig.fmap.geom.jts.util.JTSUtils;
@@ -154,4 +156,15 @@
     public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
         return JTSUtils.createGeometry(getJTS().buffer(distance));
     }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans)
+     */
+    @Override
+    public void reProject(ICoordTrans ct) {
+        super.reProject(ct);
+        if (coordinates.size()>=2 && !isClosed()) {
+            closePrimitive();
+        }
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline2D.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline2D.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline2D.java	(revision 42464)
@@ -22,9 +22,14 @@
  */
 package org.gvsig.fmap.geom.jts.primitive.surface.filledspline;
 
+import java.util.Iterator;
+
 import com.vividsolutions.jts.geom.Coordinate;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.jts.GeometryJTS;
 import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline2D;
 import org.gvsig.fmap.geom.jts.util.JTSUtils;
 import org.gvsig.fmap.geom.operation.GeometryOperationException;
@@ -153,4 +158,15 @@
     public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
         return JTSUtils.createGeometry(getJTS().buffer(distance));
     }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans)
+     */
+    @Override
+    public void reProject(ICoordTrans ct) {
+        super.reProject(ct);
+        if (coordinates.size()>=2 && !isClosed()) {
+            closePrimitive();
+        }
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline3D.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline3D.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline3D.java	(revision 42464)
@@ -24,6 +24,8 @@
 
 import com.vividsolutions.jts.geom.Coordinate;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline3D;
 import org.gvsig.fmap.geom.jts.util.JTSUtils;
@@ -154,4 +156,15 @@
     public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
         return JTSUtils.createGeometry(getJTS().buffer(distance));
     }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans)
+     */
+    @Override
+    public void reProject(ICoordTrans ct) {
+        super.reProject(ct);
+        if (coordinates.size()>=2 && !isClosed()) {
+            closePrimitive();
+        }
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/ellipticarc/AbstractEllipticArc.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/ellipticarc/AbstractEllipticArc.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/ellipticarc/AbstractEllipticArc.java	(revision 42464)
@@ -27,6 +27,7 @@
 import java.awt.geom.Arc2D;
 import java.awt.geom.PathIterator;
 
+import org.cresques.cts.CoordTransRuntimeException;
 import org.cresques.cts.ICoordTrans;
 
 import org.gvsig.fmap.geom.Geometry;
@@ -55,6 +56,10 @@
  */
 public abstract class AbstractEllipticArc extends AbstractSurface {
 
+    /**
+     *
+     */
+    private static final long serialVersionUID = 6163269454714321454L;
     protected Point axis1Start;
     protected Point axis1End;
     protected double semiAxis2Length;
@@ -260,9 +265,18 @@
         // Sería incorrecto para las de deformación en cizallamiento
 
         Point2D aux = new Point2D(JTSUtils.getPointAtYAxisInEllipse(axis1Start, axis1End, semiAxis2Length));
+        try {
         axis1Start.reProject(ct);
         axis1End.reProject(ct);
         aux.reProject(ct);
+        } catch (CoordTransRuntimeException e) {
+            //Si ha fallado la reproyección de alguno de los puntos, ponemos todas las coordenadas a 0
+            axis1Start.setX(0);
+            axis1Start.setY(0);
+            axis1End.setX(0);
+            axis1End.setY(0);
+            semiAxis2Length = 0;
+        }
         try {
             Point2D transformedMiddlePoint = new Point2D(JTSUtils.getMidPoint(axis1Start, axis1End));
             semiAxis2Length = transformedMiddlePoint.distance(aux);
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/ellipse/AbstractEllipse.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/ellipse/AbstractEllipse.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/ellipse/AbstractEllipse.java	(revision 42464)
@@ -26,6 +26,7 @@
 import java.awt.geom.AffineTransform;
 import java.awt.geom.PathIterator;
 
+import org.cresques.cts.CoordTransRuntimeException;
 import org.cresques.cts.ICoordTrans;
 
 import org.gvsig.fmap.geom.Geometry;
@@ -257,14 +258,24 @@
      * @see org.gvsig.fmap.geom.Geometry#reProject(org.cresques.cts.ICoordTrans)
      */
     public void reProject(ICoordTrans ct) {
-        //FIXME: Esto solo sería correcto para transformaciones de traslación, rotación y escala
+        // FIXME: Esto solo sería correcto para transformaciones de traslación,
+        // rotación y escala
         // Sería incorrecto para las de deformación en cizallamiento
 
         Point2D aux = new Point2D(JTSUtils.getPointAtYAxisInEllipse(init, end, ydist));
-        init.reProject(ct);
-        end.reProject(ct);
-        aux.reProject(ct);
         try {
+            init.reProject(ct);
+            end.reProject(ct);
+            aux.reProject(ct);
+        } catch (CoordTransRuntimeException e) {
+            //Si no se ha podido reproyectar alguno de los puntos, les asignamos 0 a todas las coordenadas
+            init.setX(0);
+            init.setY(0);
+            end.setX(0);
+            end.setY(0);
+            ydist = 0;
+        }
+        try {
             Point2D transformedMiddlePoint = new Point2D(JTSUtils.getMidPoint(init, end));
             ydist = transformedMiddlePoint.distance(aux);
         } catch (BaseException e) {
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/circle/AbstractCircle.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/circle/AbstractCircle.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/circle/AbstractCircle.java	(revision 42464)
@@ -26,8 +26,11 @@
 import java.awt.geom.AffineTransform;
 import java.awt.geom.PathIterator;
 
+import org.cresques.cts.CoordTransRuntimeException;
 import org.cresques.cts.ICoordTrans;
 
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
 import org.gvsig.fmap.geom.jts.gputils.DefaultGeneralPathX;
 import org.gvsig.fmap.geom.jts.primitive.point.Point2D;
 import org.gvsig.fmap.geom.jts.primitive.point.PointJTS;
@@ -41,6 +44,7 @@
 import org.gvsig.fmap.geom.primitive.Polygon;
 import org.gvsig.fmap.geom.primitive.Ring;
 import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.locator.LocatorException;
 
 
 /**
@@ -374,9 +378,16 @@
         // Sería incorrecto para las de deformación en cizallamiento
 
         Point2D aux = new Point2D(center.getX(), center.getY()-radius);
-        center.reProject(ct);
-        aux.reProject(ct);
         try {
+            center.reProject(ct);
+            aux.reProject(ct);
+        } catch (CoordTransRuntimeException e){
+            center.setX(0);
+            center.setY(0);
+            radius = 0;
+            return;
+        }
+        try {
             radius = center.distance(aux);
         } catch (BaseException e) {
             throw new UnsupportedOperationException("Error calculating the radius of the transformed circle.", e);
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon2DM.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon2DM.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon2DM.java	(revision 42464)
@@ -34,6 +34,8 @@
 import com.vividsolutions.jts.operation.buffer.BufferParameters;
 import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.GeometryException;
 import org.gvsig.fmap.geom.aggregate.MultiLine;
@@ -253,4 +255,19 @@
       public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
           return JTSUtils.createGeometry(getJTS().buffer(distance));
       }
+
+      /* (non-Javadoc)
+       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
+       */
+      @Override
+      public void reProject(ICoordTrans ct) {
+          super.reProject(ct);
+          for (Iterator<Ring> iterator = interiorRings.iterator(); iterator.hasNext();) {
+              GeometryJTS ring = (GeometryJTS) iterator.next();
+              ring.reProject(ct);
+          }
+          if (coordinates.size()>=2 && !isClosed()) {
+              closePrimitive();
+          }
+      }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon3DM.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon3DM.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon3DM.java	(revision 42464)
@@ -34,6 +34,8 @@
 import com.vividsolutions.jts.operation.buffer.BufferParameters;
 import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.GeometryException;
 import org.gvsig.fmap.geom.aggregate.MultiLine;
@@ -259,5 +261,21 @@
       public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
           return JTSUtils.createGeometry(getJTS().buffer(distance));
       }
+
+
+      /* (non-Javadoc)
+       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
+       */
+      @Override
+      public void reProject(ICoordTrans ct) {
+          super.reProject(ct);
+          for (Iterator<Ring> iterator = interiorRings.iterator(); iterator.hasNext();) {
+              GeometryJTS ring = (GeometryJTS) iterator.next();
+              ring.reProject(ct);
+          }
+          if (coordinates.size()>=2 && !isClosed()) {
+              closePrimitive();
+          }
+      }
 }
 
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon2D.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon2D.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon2D.java	(revision 42464)
@@ -34,6 +34,8 @@
 import com.vividsolutions.jts.operation.buffer.BufferParameters;
 import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.GeometryException;
 import org.gvsig.fmap.geom.aggregate.MultiLine;
@@ -270,4 +272,19 @@
     public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
         return JTSUtils.createGeometry(getJTS().buffer(distance));
     }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
+     */
+    @Override
+    public void reProject(ICoordTrans ct) {
+        super.reProject(ct);
+        for (Iterator<Ring> iterator = interiorRings.iterator(); iterator.hasNext();) {
+            GeometryJTS ring = (GeometryJTS) iterator.next();
+            ring.reProject(ct);
+        }
+        if (coordinates.size()>=2 && !isClosed()) {
+            closePrimitive();
+        }
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon3D.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon3D.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon3D.java	(revision 42464)
@@ -34,6 +34,8 @@
 import com.vividsolutions.jts.operation.buffer.BufferParameters;
 import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.GeometryException;
 import org.gvsig.fmap.geom.aggregate.MultiLine;
@@ -250,4 +252,19 @@
       public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
           return JTSUtils.createGeometry(getJTS().buffer(distance));
       }
+
+      /* (non-Javadoc)
+       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
+       */
+      @Override
+      public void reProject(ICoordTrans ct) {
+          super.reProject(ct);
+          for (Iterator<Ring> iterator = interiorRings.iterator(); iterator.hasNext();) {
+              GeometryJTS ring = (GeometryJTS) iterator.next();
+              ring.reProject(ct);
+          }
+          if (coordinates.size()>=2 && !isClosed()) {
+              closePrimitive();
+          }
+      }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/point/AbstractPoint.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/point/AbstractPoint.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/point/AbstractPoint.java	(revision 42464)
@@ -211,7 +211,8 @@
              * is out of the valid range and some computing
              * problem happens)
              */
-            throw new ReprojectionRuntimeException(ct.getPOrig(), ct.getPDest(), p, exc);
+            this.setX(0);
+            this.setY(0);
         }
     }
 
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring2DM.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring2DM.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring2DM.java	(revision 42464)
@@ -29,6 +29,8 @@
 import com.vividsolutions.jts.operation.buffer.BufferParameters;
 import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.GeometryException;
 import org.gvsig.fmap.geom.aggregate.MultiLine;
@@ -117,4 +119,16 @@
 
           return new Ring2DM(coords);
       }
+
+
+      /* (non-Javadoc)
+       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
+       */
+      @Override
+      public void reProject(ICoordTrans ct) {
+          super.reProject(ct);
+          if (coordinates.size()>=2 && !isClosed()) {
+              closePrimitive();
+          }
+      }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring3DM.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring3DM.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring3DM.java	(revision 42464)
@@ -29,6 +29,8 @@
 import com.vividsolutions.jts.operation.buffer.BufferParameters;
 import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.GeometryException;
 import org.gvsig.fmap.geom.aggregate.MultiLine;
@@ -122,4 +124,16 @@
 
           return new Ring3DM(coords);
       }
+
+
+      /* (non-Javadoc)
+       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
+       */
+      @Override
+      public void reProject(ICoordTrans ct) {
+          super.reProject(ct);
+          if (coordinates.size()>=2 && !isClosed()) {
+              closePrimitive();
+          }
+      }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring2D.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring2D.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring2D.java	(revision 42464)
@@ -31,6 +31,8 @@
 import com.vividsolutions.jts.operation.buffer.BufferParameters;
 import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.GeometryException;
 import org.gvsig.fmap.geom.aggregate.MultiLine;
@@ -122,4 +124,16 @@
 
           return new Ring2D(coords);
       }
+
+
+      /* (non-Javadoc)
+       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
+       */
+      @Override
+      public void reProject(ICoordTrans ct) {
+          super.reProject(ct);
+          if (coordinates.size()>=2 && !isClosed()) {
+              closePrimitive();
+          }
+      }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring3D.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring3D.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring3D.java	(revision 42464)
@@ -29,6 +29,8 @@
 import com.vividsolutions.jts.operation.buffer.BufferParameters;
 import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
 
+import org.cresques.cts.ICoordTrans;
+
 import org.gvsig.fmap.geom.Geometry;
 import org.gvsig.fmap.geom.GeometryException;
 import org.gvsig.fmap.geom.aggregate.MultiLine;
@@ -118,4 +120,16 @@
 
           return new Ring3D(coords);
       }
+
+
+      /* (non-Javadoc)
+       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
+       */
+      @Override
+      public void reProject(ICoordTrans ct) {
+          super.reProject(ct);
+          if (coordinates.size()>=2 && !isClosed()) {
+              closePrimitive();
+          }
+      }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/DefaultEnvelope.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/DefaultEnvelope.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/DefaultEnvelope.java	(revision 42464)
@@ -24,8 +24,10 @@
 
 package org.gvsig.fmap.geom.jts.primitive;
 
-import java.text.MessageFormat;
+import java.util.ArrayList;
 
+import com.vividsolutions.jts.geom.Coordinate;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,6 +37,9 @@
 import org.gvsig.fmap.geom.GeometryLocator;
 import org.gvsig.fmap.geom.GeometryManager;
 import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.jts.GeometryJTS;
+import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence;
+import org.gvsig.fmap.geom.jts.util.JTSUtils;
 import org.gvsig.fmap.geom.primitive.Envelope;
 import org.gvsig.fmap.geom.primitive.EnvelopeNotInitializedException;
 import org.gvsig.fmap.geom.primitive.Point;
@@ -70,6 +75,8 @@
 
     protected boolean isEmpty;
 
+    private com.vividsolutions.jts.geom.Polygon jtsGeom = null;
+
     protected static GeometryManager manager = GeometryLocator.getGeometryManager();
 
     public DefaultEnvelope(){
@@ -278,6 +285,7 @@
         if (max != null){
             isEmpty = false;
         }
+        jtsGeom = null;
     }
 
     /* (non-Javadoc)
@@ -288,6 +296,7 @@
         if (min != null){
             isEmpty = false;
         }
+        jtsGeom = null;
     }
 
     public static void registerPersistent() {
@@ -338,4 +347,28 @@
         isEmpty = true;
     }
 
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.geom.primitive.Envelope#intersects(org.gvsig.fmap.geom.Geometry)
+     */
+    @Override
+    public boolean intersects(Geometry geometry) {
+        if(geometry instanceof GeometryJTS){
+            return getJTS().intersects(((GeometryJTS)geometry).getJTS());
+        }
+        return false;
+    }
+
+
+    private com.vividsolutions.jts.geom.Geometry getJTS() {
+        if (jtsGeom == null) {
+            ArrayListCoordinateSequence coordinates = new ArrayListCoordinateSequence(new ArrayList<Coordinate>());
+            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(min.getX(), min.getY()));
+            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(getMaximum(0), getMinimum(1)));
+            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(max.getX(), max.getY()));
+            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(getMinimum(0), getMaximum(1)));
+            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(min.getX(), min.getY()));
+            jtsGeom = JTSUtils.createJTSPolygon(coordinates);
+        }
+        return jtsGeom;
+    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/Envelope2D.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/Envelope2D.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/Envelope2D.java	(revision 42464)
@@ -24,6 +24,7 @@
 
 package org.gvsig.fmap.geom.jts.primitive;
 
+import org.cresques.cts.CoordTransRuntimeException;
 import org.cresques.cts.ICoordTrans;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -127,20 +128,20 @@
 
 	    double xmin = getMinimum(0);
 	    double ymin = getMinimum(1);
-	    double step_w = 0.25 * (getMaximum(0) - xmin);
-	    double step_h = 0.25 * (getMaximum(1) - ymin);
+	    double step_w = 0.0625 * (getMaximum(0) - xmin);
+	    double step_h = 0.125 * (getMaximum(1) - ymin);
 
 	    java.awt.geom.Point2D sample = null;
 	    java.awt.geom.Point2D sample_trans = null;
 	    // Init with worst values
         java.awt.geom.Point2D res_min = new java.awt.geom.Point2D.Double(
-            Double.MAX_VALUE, Double.MAX_VALUE);
+            Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
         java.awt.geom.Point2D res_max = new java.awt.geom.Point2D.Double(
-            -Double.MAX_VALUE, -Double.MAX_VALUE);
+            Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
 
         int added = 0;
-	    for (int i=0; i<5; i++) {
-	        for (int j=0; j<5; j++) {
+	    for (int i=0; i<=16; i++) {
+	        for (int j=0; j<=8; j++) {
 	                sample = new java.awt.geom.Point2D.Double(
 	                    xmin + i * step_w,
 	                    ymin + j * step_h);
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/arc/AbstractArc.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/arc/AbstractArc.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/arc/AbstractArc.java	(revision 42464)
@@ -26,6 +26,7 @@
 import java.awt.geom.AffineTransform;
 import java.awt.geom.PathIterator;
 
+import org.cresques.cts.CoordTransRuntimeException;
 import org.cresques.cts.ICoordTrans;
 
 import org.gvsig.fmap.geom.Geometry;
@@ -210,9 +211,19 @@
         //FIXME: Esto solo sería correcto para transformaciones de traslación, rotación y escala
         // Sería incorrecto para las de deformación en cizallamiento
 
+        try {
         init.reProject(ct);
         middle.reProject(ct);
         end.reProject(ct);
+        } catch (CoordTransRuntimeException e){
+            //Si ha fallado la reproyección de alguno de los puntos, ponemos todas las coordenadas a 0
+            init.setX(0);
+            init.setY(0);
+            middle.setX(0);
+            middle.setY(0);
+            end.setX(0);
+            end.setY(0);
+        }
     }
 
     /* (non-Javadoc)
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/line/AbstractLine.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/line/AbstractLine.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/line/AbstractLine.java	(revision 42464)
@@ -24,12 +24,12 @@
 
 import java.awt.Shape;
 import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
 import java.awt.geom.PathIterator;
 import java.util.Collections;
 import java.util.Iterator;
 
 import com.vividsolutions.jts.geom.Coordinate;
-import java.awt.geom.GeneralPath;
 
 import org.apache.commons.lang3.StringUtils;
 import org.cresques.cts.ICoordTrans;
@@ -49,7 +49,6 @@
 import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
 import org.gvsig.fmap.geom.primitive.GeneralPathX;
 import org.gvsig.fmap.geom.primitive.IGeneralPathX;
-import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
 import org.gvsig.fmap.geom.primitive.Point;
 
 /**
@@ -97,7 +96,7 @@
             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
         }
 
-    }    
+    }
     /**
     *
     */
@@ -114,7 +113,7 @@
     }
 
     abstract public Point getVertex(int index);
-    
+
     public Iterator<Point> iterator() {
         return new VertexIterator();
     }
@@ -327,6 +326,8 @@
         if (ct == null) {
             return;
         }
+        ArrayListCoordinateSequence tmpCoordinates = new ArrayListCoordinateSequence();
+        tmpCoordinates.ensureCapacity(coordinates.size());
         for (Iterator<Coordinate> iterator = coordinates.iterator(); iterator.hasNext();) {
             Coordinate coordinate = (Coordinate) iterator.next();
 
@@ -335,6 +336,7 @@
                 p = ct.convert(p, p);
                 coordinate.x = p.getX();
                 coordinate.y = p.getY();
+                tmpCoordinates.add(coordinate);
             } catch (Exception exc) {
                 /*
                  * This can happen when the reprojection lib is unable
@@ -342,9 +344,9 @@
                  * is out of the valid range and some computing
                  * problem happens)
                  */
-                throw new ReprojectionRuntimeException(ct.getPOrig(), ct.getPDest(), p, exc);
             }
         }
+        coordinates=tmpCoordinates;
     }
 
     /*
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/spline/AbstractSpline.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/spline/AbstractSpline.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/spline/AbstractSpline.java	(revision 42464)
@@ -336,6 +336,8 @@
         if (ct == null) {
             return;
         }
+        ArrayListCoordinateSequence tmpCoordinates = new ArrayListCoordinateSequence();
+        tmpCoordinates.ensureCapacity(coordinates.size());
         for (Iterator<Coordinate> iterator = coordinates.iterator(); iterator.hasNext();) {
             Coordinate coordinate = (Coordinate) iterator.next();
 
@@ -344,6 +346,7 @@
                 p = ct.convert(p, p);
                 coordinate.x = p.getX();
                 coordinate.y = p.getY();
+                tmpCoordinates.add(coordinate);
             } catch (Exception exc) {
                 /*
                  * This can happen when the reprojection lib is unable
@@ -351,9 +354,9 @@
                  * is out of the valid range and some computing
                  * problem happens)
                  */
-                throw new ReprojectionRuntimeException(ct.getPOrig(), ct.getPDest(), p, exc);
             }
         }
+        coordinates=tmpCoordinates;
     }
 
     /*
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Envelope.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Envelope.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Envelope.java	(revision 42464)
@@ -138,11 +138,11 @@
      *
      * Is equivalent to:
      *  <code>add(geometry.getEnvelope())</code>
-     * 
+     *
      * @param envelope The envelope to add.
      */
     void add(Geometry geometry);
-    
+
     /**
      * It returns the equivalent of an envelope like a geometry.
      *
@@ -171,6 +171,15 @@
     boolean intersects(Envelope envelope);
 
     /**
+     * Returns <code>true</code> if the geometry intersects with the current
+     * envelope.
+     *
+     * @param geometry The geometry to compare.
+     * @return If the current envelope intersects with the geometry
+     */
+    boolean intersects(Geometry geometry);
+
+    /**
      * Converts the envelope to other coordinate reference system
      *
      * @param trans The CRS conversor
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPStoreParameters.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPStoreParameters.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPStoreParameters.java	(revision 42464)
@@ -25,9 +25,14 @@
 package org.gvsig.fmap.dal.store.shp;
 
 import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.BooleanUtils;
+import org.cresques.cts.ICRSFactory;
+import org.cresques.cts.IProjection;
 
-import org.cresques.cts.IProjection;
+import org.gvsig.fmap.crs.CRSFactory;
 import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
 import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters;
 import org.gvsig.fmap.dal.store.shp.utils.SHP;
@@ -51,7 +56,7 @@
 		fixParameters();
 		super.validate();
 	}
-	
+
 	public void fixParameters() {
 		File file = this.getSHPFile();
 		if( file!=null ) {
@@ -63,7 +68,7 @@
 			}
 		}
 	}
-	
+
 	public SHPStoreParameters(String parametersDefinitionName) {
 		super(parametersDefinitionName, SHPStoreProvider.NAME);
 	}
@@ -82,8 +87,8 @@
 	public void setFile(String fileName) {
 		this.setSHPFile(fileName);
 	}
-	
-	
+
+
 	public String getSHPFileName() {
 		if( this.getSHPFile()==null ) {
 			return null;
@@ -103,6 +108,14 @@
 		if (this.getSHXFile() == null) {
 			this.setSHXFile(SHP.getShxFile(file));
 		}
+        if (getCRS() == null){
+            String wktEsri = loadPrj(file);
+            if (wktEsri != null) {
+                IProjection proj = CRSFactory.getCRSFactory().get(ICRSFactory.FORMAT_WKT_ESRI, wktEsri);
+                setCRS(proj);
+            }
+        }
+
 	}
 
 	public void setSHPFile(String fileName) {
@@ -114,8 +127,27 @@
 		if (this.getSHXFile() == null) {
 			this.setSHXFile(SHP.getShxFile(file));
 		}
+        if (getCRS() == null){
+            String wktEsri = loadPrj(file);
+            if (wktEsri != null) {
+                IProjection proj = CRSFactory.getCRSFactory().get(ICRSFactory.FORMAT_WKT_ESRI, wktEsri);
+                setCRS(proj);
+            }
+        }
 	}
 
+	private String loadPrj(File shpFile){
+        File prjFile = SHP.getPrjFile(shpFile);
+        if (prjFile.exists()) {
+            try {
+                return FileUtils.readFileToString(prjFile);
+            } catch (IOException e) {
+                return null;
+            }
+        }
+        return null;
+	}
+
 	public String getSHXFileName() {
 		if( this.getSHXFile()==null ) {
 			return null;
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/utils/SHP.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/utils/SHP.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/utils/SHP.java	(revision 42464)
@@ -216,8 +216,8 @@
 		}
 		String[] ends = new String[] { "prj", "PRJ", "Prj", "pRj", "PRj",
 				"prJ", "PrJ", "pRJ" };
-		File shxFile = findEnd(str, files, ends);
-		return shxFile;
+		File prjFile = findEnd(str, files, ends);
+		return prjFile;
 	}
 
     private static File findEnd(String str,File[] files, String[] ends) {
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java	(revision 42464)
@@ -64,7 +64,6 @@
 import org.gvsig.fmap.dal.store.shp.utils.ISHPFile;
 import org.gvsig.fmap.dal.store.shp.utils.SHPFile2;
 import org.gvsig.fmap.geom.Geometry;
-import org.gvsig.fmap.geom.Geometry.SUBTYPES;
 import org.gvsig.fmap.geom.GeometryLocator;
 import org.gvsig.fmap.geom.GeometryManager;
 import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
@@ -111,12 +110,6 @@
     public Object getDynValue(String name) throws DynFieldNotFoundException {
         if (DataStore.METADATA_CRS.equalsIgnoreCase(name)) {
 
-            /*
-             * String srs =  this.shpFile.getSRSParameters();
-             if (srs != null){
-             // This can be non null but not sure how to handle
-             }
-             */
             return this.getShpParameters().getCRS();
 
         } else if (DataStore.METADATA_ENVELOPE.equalsIgnoreCase(name)) {
@@ -507,6 +500,14 @@
                         close();
                         resourceCloseRequest();
 
+                        //FIXME: Descomentarizar este código cuando se consiga exportar la proyección al formato de WKT_ESRI.
+//                        File tmpPrjFile = SHP.getPrjFile(tmpParams.getSHPFile());
+//                        try {
+//                        FileUtils.writeStringToFile(tmpPrjFile, tmpParams.getCRS().export(ICRSFactory.FORMAT_WKT_ESRI));
+//                        } catch(Exception e) {
+//                            logger.info("Can't write prj file '"+tmpPrjFile.getAbsolutePath()+"'.");
+//                        }
+
                         if (!shpParams.getDBFFile().delete()) {
                             logger.debug("Can't delete dbf file '"+shpParams.getDBFFile()+"'.");
                             throw new IOException("Can't delete dbf '"+FilenameUtils.getBaseName(shpParams.getDBFFileName())+"' file to replace with the new dbf.\nThe new dbf is in temporary file '"+str_base+"'");
@@ -519,6 +520,16 @@
                             logger.debug("Can't delete dbf file '"+shpParams.getSHXFile()+"'.");
                             throw new IOException("Can't delete shx '"+FilenameUtils.getBaseName(shpParams.getSHXFileName())+"' file to replace with the new shx.\nThe new shx is in temporary file '"+str_base+"'");
                         }
+                        //FIXME: Descomentarizar este código cuando se consiga exportar la proyección al formato de WKT_ESRI.
+//                        if (SHP.getPrjFile(shpParams.getSHPFile()).exists()) {
+//                            if (!SHP.getPrjFile(shpParams.getSHPFile()).delete()) {
+//                                logger.debug("Can't delete prj file '" + SHP.getPrjFile(shpParams.getSHPFile()) + "'.");
+//                                throw new IOException("Can't delete shx '"
+//                                    + FilenameUtils.getBaseName(SHP.getPrjFile(shpParams.getSHPFile()).getPath())
+//                                    + "' file to replace with the new shx.\nThe new shx is in temporary file '"
+//                                    + str_base + "'");
+//                            }
+//                        }
                         FileUtils.moveFile(
                                 tmpParams.getDBFFile(),
                                 shpParams.getDBFFile());
@@ -528,6 +539,10 @@
                         FileUtils.moveFile(
                                 tmpParams.getSHXFile(),
                                 shpParams.getSHXFile());
+                        //FIXME: Descomentarizar este código cuando se consiga exportar la proyección al formato de WKT_ESRI.
+//                        FileUtils.moveFile(
+//                            tmpPrjFile,
+//                            SHP.getPrjFile(shpParams.getSHPFile()));
 
                         resourcesNotifyChanges();
                         initFeatureType();
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/pom.xml
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/pom.xml	(revision 42463)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/pom.xml	(revision 42464)
@@ -46,7 +46,7 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-    
+
     <!--
     <dependency>
       <groupId>org.gvsig</groupId>
@@ -65,6 +65,11 @@
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.gvsig</groupId>
+      <artifactId>org.gvsig.projection.api</artifactId>
+    </dependency>
+
   </dependencies>
 
   <build>
Index: trunk/org.gvsig.desktop/pom.xml
===================================================================
--- trunk/org.gvsig.desktop/pom.xml	(revision 42463)
+++ trunk/org.gvsig.desktop/pom.xml	(revision 42464)
@@ -1426,75 +1426,6 @@
                 </plugin>
 
                 <plugin>
-                    <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
-                    <groupId>org.eclipse.m2e</groupId>
-                    <artifactId>lifecycle-mapping</artifactId>
-                    <version>1.0.0</version>
-                    <configuration>
-                        <lifecycleMappingMetadata>
-                            <pluginExecutions>
-                                <pluginExecution>
-                                    <pluginExecutionFilter>
-                                        <groupId>org.gvsig</groupId>
-                                        <artifactId> org.gvsig.installer.maven </artifactId>
-                                        <versionRange> [2.0.10-SNAPSHOT,) </versionRange>
-                                        <goals>
-                                            <goal>write-info</goal>
-                                        </goals>
-                                    </pluginExecutionFilter>
-                                    <action>
-                                        <ignore />
-                                    </action>
-                                </pluginExecution>
-                                <pluginExecution>
-                                    <pluginExecutionFilter>
-                                        <groupId> org.codehaus.mojo </groupId>
-                                        <artifactId> properties-maven-plugin </artifactId>
-                                        <versionRange> [1.0-alpha-2,) </versionRange>
-                                        <goals>
-                                            <goal>
-                                                read-project-properties
-                                            </goal>
-                                        </goals>
-                                    </pluginExecutionFilter>
-                                    <action>
-                                        <ignore />
-                                    </action>
-                                </pluginExecution>
-                                <pluginExecution>
-                                    <pluginExecutionFilter>
-                                        <groupId>org.codehaus.gmaven</groupId>
-                                        <artifactId>gmaven-plugin</artifactId>
-                                        <versionRange>[1.4,)</versionRange>
-                                        <goals>
-                                            <goal>execute</goal>
-                                        </goals>
-                                    </pluginExecutionFilter>
-                                    <action>
-                                        <ignore />
-                                    </action>
-                                </pluginExecution>
-                                <pluginExecution>
-                                    <pluginExecutionFilter>
-                                        <groupId>org.apache.maven.plugins</groupId>
-                                        <artifactId>
-                                            maven-dependency-plugin
-                                        </artifactId>
-                                        <versionRange>[2.1,)</versionRange>
-                                        <goals>
-                                            <goal>unpack</goal>
-                                        </goals>
-                                    </pluginExecutionFilter>
-                                    <action>
-                                        <ignore />
-                                    </action>
-                                </pluginExecution>
-                            </pluginExecutions>
-                        </lifecycleMappingMetadata>
-                    </configuration>
-                </plugin>
-
-                <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-compiler-plugin</artifactId>
                     <version>2.3.2</version>
@@ -2583,7 +2514,7 @@
         <!-- External project versions -->
         <gvsig.tools.version>3.0.65</gvsig.tools.version>
         <gvsig.proj.version>1.0.1</gvsig.proj.version>
-        <gvsig.projection.api.version>2.0.17</gvsig.projection.api.version>
+        <gvsig.projection.api.version>2.0.20</gvsig.projection.api.version>
 
         <gvsig.product.folder.path>${basedir}/target/product</gvsig.product.folder.path>
 
