6

I have been practising ArcGIS in JavaScript (for WMS layers ) and have always faced numerical values of SpatialReference like wkid: 102100, but now I faced in this format:

'PROJCS["NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601",' + 
'GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",' +
'SPHEROID["GRS_1980",6378137.0,298.257222101]]' +
'PRIMEM["Greenwich",0.0],' +
'UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],' +
'PARAMETER["False_Easting",8202099.737532808],PARAMETER["False_Northing",0.0],' +
'PARAMETER["Central_Meridian",-120.5],' +
'PARAMETER["Standard_Parallel_1",44.33333333333334],' +
'PARAMETER["Standard_Parallel_2",46.0],' +
'PARAMETER["Latitude_Of_Origin",43.66666666666666],UNIT["Foot",0.3048]]'

I came across the explanation of the wkt usage but do not know how to use it together with extent. Is there any correct syntax / solution / tutorial I could learn from?

4

The string you've pasted is a WKT projection information. This can be converted into an EPSG code if you would like to, but you can use it directly to construct a SpatialReference object in Esri JavaScript API.

require([
  "esri/SpatialReference", ... 
], function(SpatialReference, ... ) {
  var sr = new SpatialReference('GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",
    SPHEROID["WGS_1984",6378137.0,298.257223563]],
    PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]'
  );
  ...
});

The Extent object can be then constructed using the SpatialReference object you've created.

  • you mean I have to write in a: require([ 'esri/SpatialReference', ''esri/geometry/Extent', ... ], function (SpatialReference, ...) // define map // define layers var sr = new SpatialReference('GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984", SPHEROID["WGS_1984",6378137.0,298.257223563]], PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]' ); var resourceInfo = { var extent = new Extent(-126.40869140625, 31.025390625, -109.66552734375, 41.5283203125,{wkt: sr }), layerInfos: [...] }; format? – Stephan Gt Jul 11 '17 at 9:24
  • Look at the Extent constructor information - it has examples on how to specify the spatial reference; you would be supplying {"spatialReference": sr} – Alex Tereshenkov Jul 12 '17 at 16:55
  • Thank you! Found another way with no definition of extent and sr values. But thank you -- yours was helpful. – Stephan Gt Jul 13 '17 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.