OpenStreetMap Reprojection with ScaleLine Control

reprojection projection openstreetmap nad83 tile scaleline

Demonstrates client-side reprojection of OpenStreetMap to NAD83 Indiana East.

This example shows client-side reprojection of OpenStreetMap to NAD83 Indiana East, including a ScaleLine control with US units.

index.html<!DOCTYPE html>
<html lang="en">
    <title>OpenStreetMap Reprojection with ScaleLine Control</title>
    <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>
      .map {
        width: 100%;
    <div id="map" class="map"></div>
    <script src="index.js"></script>
index.jsimport 'ol/ol.css';
import Map from 'ol/Map';
import View from 'ol/View';
import {ScaleLine} from 'ol/control';
import TileLayer from 'ol/layer/Tile';
import {fromLonLat, transformExtent} from 'ol/proj';
import {register} from 'ol/proj/proj4';
import OSM from 'ol/source/OSM';
import proj4 from 'proj4';

proj4.defs('Indiana-East', 'PROJCS["IN83-EF",GEOGCS["LL83",DATUM["NAD83",' +
    'SPHEROID["GRS1980",6378137.000,298.25722210]],PRIMEM["Greenwich",0],' +
    'UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],' +
    'PARAMETER["false_easting",328083.333],' +
    'PARAMETER["false_northing",820208.333],' +
    'PARAMETER["scale_factor",0.999966666667],' +
    'PARAMETER["central_meridian",-85.66666666666670],' +
    'PARAMETER["latitude_of_origin",37.50000000000000],' +

var map = new Map({
  layers: [
    new TileLayer({
      source: new OSM()
  target: 'map',
  view: new View({
    projection: 'Indiana-East',
    center: fromLonLat([-85.685, 39.891], 'Indiana-East'),
    zoom: 7,
    extent: transformExtent([-172.54, 23.81, -47.74, 86.46],
      'EPSG:4326', 'Indiana-East'),
    minZoom: 6

map.addControl(new ScaleLine({units: 'us'}));
  "name": "scaleline-indiana-east",
  "dependencies": {
    "ol": "6.3.1"
  "devDependencies": {
    "parcel": "1.11.0"
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build --experimental-scope-hoisting --public-url . index.html"