You are here

testWKT.html in Proj4JS 7

testing WKT parser

nameunitsprojwkt

File

lib/proj4js/test/testWKT.html
View source
<html>
<head>
<script type="text/javascript" src="../lib/proj4js.js"></script>
<script type="text/javascript">

var aWKT = [
'GEOGCS["WGS84 Lat/Long Degrees -180 ==> +180",DATUM["D_WGS_1984",SPHEROID["World_Geodetic_System_of_1984",6378137,298.257222932867]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]',
'PROJCS["ALG-S-AN",GEOGCS["VOIR1875",DATUM["VOIR1875",SPHEROID["CLRK-IGN",6378249.200,293.46602129],TOWGS84[-73.0000,-247.0000,227.0000,0.000000,0.000000,0.000000,0.00000000]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert Tangential Conformal Conic Projection"],PARAMETER["false_easting",500000.000],PARAMETER["false_northing",300000.000],PARAMETER["scale_factor",0.999625800000],PARAMETER["central_meridian",2.70000000000000],PARAMETER["latitude_of_origin",33.30000000000000],UNIT["Meter",1.00000000000000]]',
'PROJCS["CANQ27-M15M",GEOGCS["LL27",DATUM["NAD27",SPHEROID["CLRK66",6378206.400,294.97869821]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["false_easting",304800.000],PARAMETER["false_northing",0.000],PARAMETER["scale_factor",0.999900000000],PARAMETER["central_meridian",-90.00000000000000],PARAMETER["latitude_of_origin",0.00000000000000],UNIT["Meter",1.00000000000000]]',
'LOCAL_CS["Non-Earth (Meter)",LOCAL_DATUM["Local Datum",0],UNIT["Meter", 1],AXIS["X",EAST],AXIS["Y",NORTH]]',
'PROJCS["SVY21",GEOGCS["SVY21[WGS84]",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",28001.642],PARAMETER["False_Northing",38744.572],PARAMETER["Central_Meridian",103.8333333333333],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",1.366666666666667],UNIT["Meter",1.0]]'
];

var wktRE = /^\,(\w+)\[(.*)\]/;

window.onload = function() {
  var table = document.getElementById('resultsTable');
  for (var i=0; i<aWKT.length; ++i) {
    var tr = document.createElement('tr');
    var wkt = aWKT[i];
    //wkt = ','+wkt;
    var testProj = new Proj4js.Proj(wkt);
    
    var td = document.createElement('td');
    td.innerHTML = testProj.srsCode;
    tr.appendChild(td);
    
    td = document.createElement('td');
    td.innerHTML = testProj.units;
    tr.appendChild(td);
    
    td = document.createElement('td');
    td.innerHTML = testProj.projName;
    tr.appendChild(td);
    
    td = document.createElement('td');
    td.innerHTML = wkt;
    tr.appendChild(td);
    table.appendChild(tr);
  }
}

</script>
</head>
<body>
<h2>testing WKT parser</h2>
<table id='resultsTable'>
  <tr><th>name</th><th>units</th><th>proj</th><th align="left">wkt</th></tr>
</table>
</body>
</html>