Hi,
  We have a number of shapefiles that don’t have .prj files, but do have .xml 
files that list a coordinateSystem. Does anyone have a method within GeoTools 
that can convert the coordinate system name to a valid CRS so we can reproject?

example: shapefile.xml

<?xml version="1.0" encoding="UTF-8"?>
<data>
        <coordinateSystem>
                <name>Universal Transverse Mercator - Zone 13 (N)</name>
                <datum>North American 1983 (mean for CONUS)</datum>
                <system>Transverse Mercator</system>
        ...


Based on my research, I think the CRS Code should be EPSG:32613
http://spatialreference.org/ref/epsg/wgs-84-utm-zone-13n/

But, how to get there with the info available is stumping me

Files available:
shapefile.shp
shapefile.xml
shapefile.sbn
shapefile.sbx
shapefile.shx
shapefile.shp.xml
shapefile.dbf


I’ve made two attempts:

1. Try and get the CRS from the schema — issue it’s NULL

        Map<String, URL> connect = new HashMap<>();
        connect.put("url", shapefile.toURI().toURL());
        CoordinateReferenceSystem crs = 
featureSource.getSchema().getCoordinateReferenceSystem();
        // issue crs is null;

2. Try and get the CRS by parsing the name, issue — it appears to be wrong

        Set<String> supportedCodes = CRS.getSupportedCodes("Universal 
Transverse Mercator - Zone 13 (N)");
        CoordinateReferenceSystem decode = 
CRS.decode(supportedCodes.iterator().next());
        logger.debug("{}", decode);


DEBUG 2016-06-09 11:08:16,104 11958 [main []] 
(ShapefileConverterITCase.java:48) 
org.tdar.db.conversion.ShapefileConverterITCase - GEOGCS["WGS84(DD)", 
  DATUM["WGS84", 
    SPHEROID["WGS84", 6378137.0, 298.257223563]], 
  PRIMEM["Greenwich", 0.0], 
  UNIT["degree", 0.017453292519943295], 
  AXIS["Geodetic longitude", EAST], 
  AXIS["Geodetic latitude", NORTH]]
        

Any ideas?

thanks,

adam
-- 
_________________________________________________________
Adam Brin
Director of Technology, Digital Antiquity
480.965.1278

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to