/*********************************************** Converts KML and KMZ files into ESRI Shapefile format, projecting the spatial data into the BC-Albers coordinate system Usage: jeql kmlToShape_BCAlbers.jql The resulting shapefile will be created in the directory the script is run in, with the same name as the input file. A .prj containing the ESRI-compatible BC-Albers coordinate system WKT is also written. ***********************************************/ import ca.bc.BCCoordSys; srcFile = Script.arg(0); destFile = File.nameNoExt(srcFile) + ".shp"; Print "Converting KML file " + srcFile + " to " + destFile; KMLReader t file: srcFile; tbc = select BCCoordSys.geoToAlbers(geometry) geom, * except geometry from t; ShapefileWriter tbc prj: 'PROJCS["PCS_Albers",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Albers"],PARAMETER["False_Easting",1000000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-126.0],PARAMETER["Standard_Parallel_1",50.0],PARAMETER["Standard_Parallel_2",58.5],PARAMETER["Latitude_Of_Origin",45.0],UNIT["Meter",1.0]]' file: destFile;