Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  <title>Client-side projection</title>

  <link rel="stylesheet" href="">
  <link rel="stylesheet" href="">
    #mapDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;

    #coordinateString {
      position: absolute;
      bottom: 10px;
      left: 10px;
      z-index: 99999;
      background: white;
      padding: 5px;
      font: "Helvetica Neue";

  <script src=""></script>
    ], function(Map, esriRequest, esriConfig,
      Point, SpatialReference, projection, coordinateFormatter,
      SimpleLineSymbol, SimpleMarkerSymbol,
      Color, Graphic, GraphicsLayer, esriBasemaps) {
      // Use CORS to get earthquakes geojson""); // supports CORS
      // check if the client side projection engine is supported in the browser. 
      // The browser must support WebAssembly.
      if (!projection.isSupported()) {
        alert("client-side projection is not supported");
      // load the projection module 
      const projectionPromise = projection.load();
      // request all earthquakes for last week as geojson
      const dataRequestPromise = esriRequest({
        url: "",
        handleAs: 'json'
      // load the coordinate formatter module
      // coordinateFormatter spatial reference 
      const geoSpatialReference = new SpatialReference({
        wkid: 4326
      // add a dark gray basemap in winkel III projection
      esriBasemaps.winkel = {
        baseMapLayers: [{
          url: ""
        thumbnailUrl: "",
        title: "Winkel"
      const viewSpatialReference = new SpatialReference({
        wkid: 54042 // winkel III
      // simple marker symbol to represent earthquake locations
      const earthquakeMarker = new SimpleMarkerSymbol("solid", 8, null, new Color([238, 69, 0, 0.5]))
      // center of the map
      const point = new Point({
        x: 6832.430696818978,
        y: -209082.39095501788,
        spatialReference: viewSpatialReference
      // create a map with winkel III basemap
      const map = new Map("mapDiv", {
        basemap: "winkel",
        center: point,
        scale: 166418924.8107909
      map.on("load", function() {
        // earthquakes graphicslayer
        const graphicsLayer = new GraphicsLayer();
        projectionPromise.then(function() {
          // read the geojson data from esriRequest promise
          dataRequestPromise.then(function(response) {
              // loop through geojson earthquakes and process the data
    , i) {
                const inSpatialReference = new SpatialReference({
                  wkid: 4326
                // create a point from a geoJSON point and set its spatialReference to WGS84
                const point = new Point(feature.geometry.coordinates, inSpatialReference);
                // project the point from WGS84 to winkel III projection
                const projectedPoint = projection.project(point, viewSpatialReference);
                // create new graphic and set its geometry to the projected point
                const attributes = {
                  ObjectID: i
                const graphic = new Graphic(projectedPoint, earthquakeMarker, attributes);
                // add the graphic representing earthquake location to the graphicslayer
            .otherwise(function(error) {
              console.log("error happened while projecting", error);
      // listen to mouse-move event of the map and print out the location of the mouse
      // on the map in decimal degrees using coordinate formatter.
      map.on("mouse-move", function(evt) {
        // exit if coordinateFormatter or projection modules are not loaded 
        if (!coordinateFormatter.isLoaded() || !projection.isLoaded()) {
        // The point's spatial reference should either be WGS84 or a geographic coordinate system
        // so project the point from Winkel III to WGS84. 
        const wgs84Point = projection.project(evt.mapPoint, geoSpatialReference);
        // display the point coordinates in decimal degrees
        if (wgs84Point) {
          //document.getElementById("coordinateString").innerHTML = "Decimal Degrees: " +
          // coordinateFormatter.toLatitudeLongitude(wgs84Point, "dd", 3);
          document.getElementById("coordinateString").innerHTML = "UTM " +
            coordinateFormatter.toUtm(wgs84Point, "north-south-indicators", true);

<body class="calcite">
  <div id="coordinateString"></div>
  <div id="mapDiv"></div>