CRSLocation
The Coordinate Reference System (CRS) that maps SketchUp model coordinates to real-world geographic coordinates.
A CRS defines the origin, orientation, and scale relationship
between the SketchUp coordinate system (in inches) and a
projected map coordinate system like UK OS National Grid or
UTM. Construct one and pass it to
op.modelSetCRSLocation(), or read the current one with
model.getCRSLocation().
Use localToWorld() to convert SketchUp points to map
coordinates, and worldToLocal() to do the reverse.
Example
Section titled “Example”// Define a CRS for UK OS National Gridlet crs = new SketchUpApi.CRSLocation({ name: 'EPSG:27700', eastings: 530000, northings: 180000, height: 0, scale: SketchUpApi.CRSScale.Meters,});
// Convert model origin to world coordinateslet world = crs.localToWorld( new SketchUpApi.Point3d(0, 0, 0));console.log(world.easting);// => 530000console.log(world.northing);// => 180000- Model.getCRSLocation
- Operation.modelSetCRSLocation
- CRSScale
- IFC IfcProjectedCRS
- IFC IfcMapConversion
SDK 2.28.0
Implements
Section titled “Implements”Constructor
Section titled “Constructor”Constructor
Section titled “Constructor”new CRSLocation(
crsData):CRSLocation
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”CRSLocation
Properties
Section titled “Properties”calibrationFileName?
Section titled “calibrationFileName?”
readonlyoptionalcalibrationFileName?:string
Optional metadata that should be set IF the CRS was defined from a calibration file.
Calibration files are typically either .jxl or .dc files.
Implementation of
Section titled “Implementation of”CRSLocationData.calibrationFileName
description?
Section titled “description?”
readonlyoptionaldescription?:string
The description of the coordinate reference system.
This should not be parsed in any meaningful way.
Implementation of
Section titled “Implementation of”eastings
Section titled “eastings”
readonlyeastings:number
The offset in the “X” direction from the CRS center to the origin of the SketchUp model
Implementation of
Section titled “Implementation of”geodeticDatum?
Section titled “geodeticDatum?”
readonlyoptionalgeodeticDatum?:string
Optional string that identifies the geodetic datum for the CRS. Typically only defined if the “name” field is not specific enough
Implementation of
Section titled “Implementation of”height
Section titled “height”
readonlyheight:number
The offset from “0” in the “Z” direction at the origin of the SketchUp model
Implementation of
Section titled “Implementation of”mapProjection?
Section titled “mapProjection?”
readonlyoptionalmapProjection?:string
Optional string that identifies the map projection used by the CRS. Typically only defined if the “name” field is not specific enough
Implementation of
Section titled “Implementation of”mapUnit?
Section titled “mapUnit?”
readonlyoptionalmapUnit?:MapUnit
Optional unit for the CRS
If not defined, Meters is assumed. When overriding this value, make sure to set the appropriate value for scale.
Implementation of
Section titled “Implementation of”mapZone?
Section titled “mapZone?”
readonlyoptionalmapZone?:string
Optional string that identifies the map zone used by the CRS. Typically only defined if the “name” field is not specific enough
Implementation of
Section titled “Implementation of”
readonlyname:string
The name of the coordinate reference system being used.
It is convention for this to reference an EPSG code in the form “EPSG:27700”
Implementation of
Section titled “Implementation of”northings
Section titled “northings”
readonlynorthings:number
The offset in the “Y” direction from the CRS center to the origin of the SketchUp model
Implementation of
Section titled “Implementation of”
readonlyscale:number
Represents the conversion between the units of the SketchUp coordinate system (inches) and the units of the CRS.
If not present, the scale will be determined based on the map unit If the map unit is not present, it is assumed to be Meters and this will default to
Implementation of
Section titled “Implementation of”tglID?
Section titled “tglID?”
readonlyoptionaltglID?:string
If present - the Trimble Geodetic Library encoding of the CRS This can be used to perform conversions between the CRS and WGS84
Implementation of
Section titled “Implementation of”verticalDatum?
Section titled “verticalDatum?”
readonlyoptionalverticalDatum?:string
Optional string that identifies the map zone used by the CRS. Typically only defined if the “name” field is not specific enough
Implementation of
Section titled “Implementation of”
readonlyxAxis:Vector2d
The direction vector of the xAxis as projected on the 2d plane of the CRS
The x value represents the xAxisAbscissa from the IFC spec The y value represents the xAxisOrdinate from the IFC spec
If not present the vector [1, 0] is assumed
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”localToWorld()
Section titled “localToWorld()”localToWorld(
suPoint):CRSPoint
Converts a SketchUp model point to world CRS coordinates, applying the rotation, scale, and origin offset defined by this CRS.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
the point in SketchUp model coordinates |
Returns
Section titled “Returns”CRSPoint
the corresponding CRSPoint in world coordinates
toString()
Section titled “toString()”toString():
string
Returns a string representation of an object.
Returns
Section titled “Returns”string
worldToLocal()
Section titled “worldToLocal()”worldToLocal(
worldPoint):Point3d
Converts a world CRS coordinate to a local SketchUp point, applying the rotation, scale, and origin offset defined by this CRS.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
the point in CRS world coordinates |
Returns
Section titled “Returns”the corresponding point in SketchUp model coordinates