Add example with US scale line and reprojection
This commit is contained in:
11
examples/scaleline-indiana-east.html
Normal file
11
examples/scaleline-indiana-east.html
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
layout: example.html
|
||||
title: OpenStreetMap Reprojection with ScaleLine Control
|
||||
shortdesc: Demonstrates client-side reprojection of OpenStreetMap to NAD83 Indiana East.
|
||||
docs: >
|
||||
This example shows client-side reprojection of OpenStreetMap to NAD83 Indiana East, including a ScaleLine control with US units.
|
||||
tags: "reprojection, projection, openstreetmap, nad83, tile, scaleline"
|
||||
resources:
|
||||
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
35
examples/scaleline-indiana-east.js
Normal file
35
examples/scaleline-indiana-east.js
Normal file
@@ -0,0 +1,35 @@
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.control.ScaleLine');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.source.OSM');
|
||||
|
||||
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],' +
|
||||
'UNIT["Foot_US",0.30480060960122]]');
|
||||
|
||||
var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.OSM()
|
||||
})
|
||||
],
|
||||
target: 'map',
|
||||
view: new ol.View({
|
||||
projection: 'Indiana-East',
|
||||
center: ol.proj.fromLonLat([-85.685, 39.891], 'Indiana-East'),
|
||||
zoom: 7,
|
||||
extent: ol.proj.transformExtent([-172.54, 23.81, -47.74, 86.46],
|
||||
'EPSG:4326', 'Indiana-East'),
|
||||
minZoom: 6
|
||||
})
|
||||
});
|
||||
|
||||
map.addControl(new ol.control.ScaleLine({units: 'us'}));
|
||||
Reference in New Issue
Block a user