Igualar proyecciones!!
parent
32fd195c94
commit
7f824052a3
|
|
@ -843,7 +843,7 @@ namespace OliviaAddInPro.Helper
|
|||
return res;
|
||||
}
|
||||
|
||||
public static bool ExportShp2(string pathLayerIn, SpatialQueryFilter filter, string nameShp, string outpath, IprocessManager cps, int incmax=100)
|
||||
public static bool ExportShp2(string pathLayerIn, SpatialQueryFilter filter, string nameShp, string outpath, IprocessManager cps, ArcGIS.Core.Geometry.SpatialReference sr=null, int incmax=100 )
|
||||
{
|
||||
if (!System.IO.Directory.Exists(outpath))
|
||||
System.IO.Directory.CreateDirectory(outpath);
|
||||
|
|
@ -885,9 +885,15 @@ namespace OliviaAddInPro.Helper
|
|||
///Exporta
|
||||
string[] args = { pathLayerIn, outpath, nameShp, whereClause };
|
||||
// execute the tool
|
||||
if(sr==null)
|
||||
{
|
||||
sr= fc.GetDefinition().GetSpatialReference();
|
||||
}
|
||||
var environments = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: sr);
|
||||
//SpatialReferenceBuilder.CreateSpatialReference(3857)
|
||||
double valini = cps.GetProgress(); ;
|
||||
IGPResult gpResult = Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass_conversion", args,
|
||||
null, null,
|
||||
environments, null,
|
||||
|
||||
(event_name, o) => // implement delegate and handle events
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ namespace OliviaAddInPro.Services
|
|||
public string ErrStr = "";
|
||||
SpatialQueryFilter filtroEspacial = null;
|
||||
SpatialReference spatRef = null;
|
||||
SpatialReference spatRefData = null;
|
||||
|
||||
public TratamientoComun com;
|
||||
/**
|
||||
* Acciones para comenzar ejecución
|
||||
|
|
@ -68,17 +70,17 @@ namespace OliviaAddInPro.Services
|
|||
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + ErrStr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//mira spatialreference de los datos de entrada
|
||||
spatRef = geom_export.SpatialReference;
|
||||
spatRefData = geom_export.SpatialReference;
|
||||
//AQUÍ COMPARAR SI ES IGUAL QUE SPATREFDEF Y SI NO, REPROYECTAR
|
||||
if(spatRef.Wkid!=GeneralDef.SpatRefDef)
|
||||
/*if(spatRef.Wkid!=GeneralDef.SpatRefDef)
|
||||
{
|
||||
/*
|
||||
* FALTA HACER
|
||||
* dame_geom_coords en v2010
|
||||
*/
|
||||
}
|
||||
//}
|
||||
|
||||
//crea el filtro de exportación
|
||||
filtroEspacial = HelperGdb.CreateFiler(com.ConsultaAmbs, geom_export);
|
||||
|
|
@ -98,7 +100,7 @@ namespace OliviaAddInPro.Services
|
|||
com.ProgrSrc.IncMessage(10, "Exportando ámbitos de trabajo");
|
||||
|
||||
//exporta los datos de entrada
|
||||
if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, 40))
|
||||
if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, null, 40))
|
||||
{
|
||||
ErrStr = "Error al exportar los ámbitos: " + HelperGdb.OutStr;
|
||||
return false;
|
||||
|
|
@ -203,17 +205,26 @@ namespace OliviaAddInPro.Services
|
|||
|
||||
//mira spatialreference del nw
|
||||
FeatureClass fc = HelperGdb.GetFtClass(OliviaGlob.Paths.PathGdbNw);
|
||||
/*
|
||||
if (fc != null)
|
||||
{
|
||||
spatRef = fc.GetDefinition().GetSpatialReference();
|
||||
//AQUÍ COMPARAR SI ES IGUAL QUE SPATREFDEF Y SI NO, REPROYECTAR
|
||||
if (spatRef.Wkid != GeneralDef.SpatRefDef)
|
||||
if (spatRef.Wkid != spatRefData.Wkid)
|
||||
{
|
||||
var sp_ref = SpatialReferenceBuilder.CreateSpatialReference(102629); // NAD83 SP AL E FIPS 0101 Feet
|
||||
|
||||
var envi = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: sp_ref);
|
||||
//https://pro.arcgis.com/es/pro-app/2.8/tool-reference/environment-settings/output-coordinate-system.htm
|
||||
//ProjectionTransformation transf_forTarget = ProjectionTransformation.Create(spatRef, spatRefData);
|
||||
|
||||
//geom_export=GeometryEngine.Instance.ProjectEx(geom_export, transf_forTarget);
|
||||
//transf_forTarget.Transformation
|
||||
/*
|
||||
* FALTA HACER
|
||||
*/
|
||||
* /
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//Hace el filtro con la geometría final
|
||||
filtroEspacial = HelperGdb.CreateFiler(String.Empty, geom_export);
|
||||
|
|
@ -228,7 +239,7 @@ namespace OliviaAddInPro.Services
|
|||
//Prepara nombre de exportación
|
||||
com.NombreShpExportNw = prefNameExportNw + fechaHora + extShp;
|
||||
//exporta los datos de entrada
|
||||
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc,100))
|
||||
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData,100))
|
||||
{
|
||||
ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr;
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue