Merge branch 'master' into utfgrid

This commit is contained in:
Tim Schaub
2012-02-25 16:08:11 -07:00
100 changed files with 1690 additions and 721 deletions

View File

@@ -5,12 +5,7 @@ function init() {
map = new OpenLayers.Map({
div: "map",
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(
-20037508, -20037508, 20037508, 20037508
)
displayProjection: new OpenLayers.Projection("EPSG:4326")
});
var g = new OpenLayers.Layer.Google("Google Layer", {

View File

@@ -5,10 +5,6 @@ function init() {
map = new OpenLayers.Map({
div: "map",
projection: "EPSG:900913",
units: "m",
maxExtent: new OpenLayers.Bounds(
-20037508.34, -20037508.34, 20037508.34, 20037508.34
),
controls: [],
fractionalZoom: true
});

View File

@@ -33,18 +33,27 @@
var pointLayer = new OpenLayers.Layer.Vector("Point Layer");
var lineLayer = new OpenLayers.Layer.Vector("Line Layer");
var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
var boxLayer = new OpenLayers.Layer.Vector("Box layer");
map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer]);
map.addLayers([wmsLayer, pointLayer, lineLayer, polygonLayer, boxLayer]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());
drawControls = {
point: new OpenLayers.Control.DrawFeature(pointLayer,
OpenLayers.Handler.Point),
OpenLayers.Handler.Point),
line: new OpenLayers.Control.DrawFeature(lineLayer,
OpenLayers.Handler.Path),
OpenLayers.Handler.Path),
polygon: new OpenLayers.Control.DrawFeature(polygonLayer,
OpenLayers.Handler.Polygon)
OpenLayers.Handler.Polygon),
box: new OpenLayers.Control.DrawFeature(boxLayer,
OpenLayers.Handler.RegularPolygon, {
handlerOptions: {
sides: 4,
irregular: true
}
}
)
};
for(var key in drawControls) {
@@ -80,11 +89,11 @@
<h1 id="title">OpenLayers Draw Feature Example</h1>
<div id="tags">
point, line, linestring, polygon, digitizing, geometry, draw, drag
point, line, linestring, polygon, box, digitizing, geometry, draw, drag
</div>
<p id="shortdesc">
Demonstrate on-screen digitizing tools for point, line, and polygon creation.
Demonstrate on-screen digitizing tools for point, line, polygon and box creation.
</p>
<div id="map" class="smallmap"></div>
@@ -107,6 +116,10 @@
<input type="radio" name="type" value="polygon" id="polygonToggle" onclick="toggleControl(this);" />
<label for="polygonToggle">draw polygon</label>
</li>
<li>
<input type="radio" name="type" value="box" id="boxToggle" onclick="toggleControl(this);" />
<label for="boxToggle">draw box</label>
</li>
<li>
<input type="checkbox" name="allow-pan" value="allow-pan" id="allowPanCheckbox" checked=true onclick="allowPan(this);" />
<label for="allowPanCheckbox">allow pan while drawing</label>
@@ -119,6 +132,8 @@
Double-click to finish drawing.</p>
<p>With the polygon drawing control active, click on the map to add the points that make up your
polygon. Double-click to finish drawing.</p>
<p>With the box drawing control active, click in the map and drag the mouse to get a rectangle. Release
the mouse to finish.</p>
<p>With any drawing control active, paning the map can still be achieved. Drag the map as
usual for that.</p>
<p>Hold down the shift key while drawing to activate freehand mode. While drawing lines or polygons

View File

@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers Google (Static Maps API) Grid Layer Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<h1 id="title">Google (Static Maps API) Grid Layer Example</h1>
<div id="tags">
Google, grid, static, GMaps
</div>
<p id="shortdesc">
Using the Google Static Maps API with a Grid Layer.
</p>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>A Grid layer with a custom <code>getURL</code> method can be
used to request static maps for a specific extent and zoom
level. The Google Static Maps API is the most reliable way to
get Google base maps in OpenLayers. Note, however, that the
free version of this is limited to a map size of 640x640 pixels
(1280x1280 if the <code>scale=2</code> url parameter is used)
and 1000 page views per viewer per day. Every map center
or zoom level change increases the page view counter by 1.
</p>
<p>Look at the
<a href="google-static.js" target="_blank">google-static.js
source</a> to see how this is done. See the
<a href="http://code.google.com/apis/maps/documentation/staticmaps/">Static Maps API V2 Developer Guide</a>
for details on the API.
</div>
<script src="../lib/OpenLayers.js"></script>
<script src="google-static.js"></script>
</body>
</html>

61
examples/google-static.js Normal file
View File

@@ -0,0 +1,61 @@
var options = {
singleTile: true,
ratio: 1,
isBaseLayer: true,
wrapDateLine: true,
getURL: function() {
var center = this.map.getCenter().transform("EPSG:3857", "EPSG:4326"),
size = this.map.getSize();
return [
this.url, "&center=", center.lat, ",", center.lon,
"&zoom=", this.map.getZoom(), "&size=", size.w, "x", size.h
].join("");
}
};
var map = new OpenLayers.Map({
div: "map",
projection: "EPSG:3857",
numZoomLevels: 22,
layers: [
new OpenLayers.Layer.Grid(
"Google Physical",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=terrain",
null, options
),
new OpenLayers.Layer.Grid(
"Google Streets",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=roadmap",
null, options
),
new OpenLayers.Layer.Grid(
"Google Hybrid",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=hybrid",
null, options
),
new OpenLayers.Layer.Grid(
"Google Satellite",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=satellite",
null, options
),
// the same layer again, but scaled to allow map sizes up to 1280x1280 pixels
new OpenLayers.Layer.Grid(
"Google Satellite (scale=2)",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=satellite&scale=2",
null, OpenLayers.Util.applyDefaults({
getURL: function() {
var center = this.map.getCenter().transform("EPSG:3857", "EPSG:4326"),
size = this.map.getSize();
return [
this.url, "&center=", center.lat, ",", center.lon,
"&zoom=", (this.map.getZoom() - 1),
"&size=", Math.floor(size.w / 2), "x", Math.floor(size.h / 2)
].join("");
}
}, options)
),
],
center: new OpenLayers.LonLat(10.2, 48.9).transform("EPSG:4326", "EPSG:3857"),
zoom: 5
});
map.addControl(new OpenLayers.Control.LayerSwitcher());

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="google-v3-alloverlays.js"></script>
</head>

View File

@@ -41,12 +41,7 @@ var init = function (onSelectFeatureFunction) {
div: "map",
theme: null,
projection: sm,
units: "m",
numZoomLevels: 18,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(
-20037508.34, -20037508.34, 20037508.34, 20037508.34
),
controls: [
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.TouchNavigation({

View File

@@ -41,12 +41,7 @@ function init() {
map = new OpenLayers.Map({
div: 'map',
projection: 'EPSG:900913',
units: 'm',
numZoomLevels: 18,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(
-20037508.34, -20037508.34, 20037508.34, 20037508.34
),
controls: [
new OpenLayers.Control.TouchNavigation({
dragPanOptions: {

View File

@@ -7,7 +7,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css">
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<link rel="stylesheet" href="style.mobile.css" type="text/css">
<link rel="stylesheet" href="style.mobile-jq.css" type="text/css">
<script src="../lib/OpenLayers.js?mobile"></script>

View File

@@ -5,12 +5,7 @@ function init() {
div: "map",
theme: null,
projection: new OpenLayers.Projection("EPSG:900913"),
units: "m",
numZoomLevels: 18,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(
-20037508.34, -20037508.34, 20037508.34, 20037508.34
),
controls: [
new OpenLayers.Control.TouchNavigation({
dragPanOptions: {

View File

@@ -9,6 +9,12 @@ html, body, #map {
#title, #tags, #shortdesc {
display: none;
}
.olTileImage {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
div.olControlAttribution {
position: absolute;
font-size: 10px;

View File

@@ -7,7 +7,6 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="mobile-wmts-vienna.css" type="text/css">
<script src="../lib/OpenLayers.js"></script>
</head>
<body>
<h1 id="title">City of Vienna WMTS for Desktop and Mobile Devices</h1>
@@ -22,6 +21,7 @@
functionality and uses the Geolocate control.
</p>
<div id="map"></div>
<script src="../lib/OpenLayers.js"></script>
<script src="mobile-wmts-vienna.js"></script>
</body>
</html>

View File

@@ -152,7 +152,6 @@ var map;
var defaults = {
requestEncoding: "REST",
matrixSet: "google3857",
buffer: 4,
attribution: 'Datenquelle: Stadt Wien - <a href="http://data.wien.gv.at">data.wien.gv.at</a>'
};
var doc = request.responseText,
@@ -182,7 +181,6 @@ var map;
requestEncoding: "REST",
matrixSet: "google3857",
tileFullExtent: extent,
buffer: 4,
attribution: 'Datenquelle: Stadt Wien - <a href="http://data.wien.gv.at">data.wien.gv.at</a>'
};
fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({

View File

@@ -96,6 +96,7 @@
if (rotate || drag) {
controls.modify.mode &= ~OpenLayers.Control.ModifyFeature.RESHAPE;
}
controls.modify.createVertices = document.getElementById("createVertices").checked;
var sides = parseInt(document.getElementById("sides").value);
sides = Math.max(3, isNaN(sides) ? 0 : sides);
controls.regular.handler.sides = sides;
@@ -161,6 +162,11 @@
onclick="toggleControl(this);" />
<label for="modifyToggle">modify feature</label>
<ul>
<li>
<input id="createVertices" type="checkbox" checked
name="createVertices" onchange="update()" />
<label for="createVertices">allow vertices creation</label>
</li>
<li>
<input id="rotate" type="checkbox"
name="rotate" onchange="update()" />

View File

@@ -3,12 +3,7 @@ var map;
function init() {
map = new OpenLayers.Map({
div: "map",
projection: new OpenLayers.Projection("EPSG:900913"),
units: "m",
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(
-20037508, -20037508, 20037508, 20037508.34
)
projection: new OpenLayers.Projection("EPSG:900913")
});
var osm = new OpenLayers.Layer.OSM();

View File

@@ -91,8 +91,7 @@
maxExtent: new OpenLayers.Bounds(-8242894.927728, 4965204.031195,
-8227290.161511, 4994963.723637),
maxResolution: 116.24879860156216,
projection: "EPSG:900913",
units: "m"
projection: "EPSG:900913"
};
var map2 = new OpenLayers.Map('map2', mapOptions);

View File

@@ -12,7 +12,10 @@
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
.olControlAttribution {
bottom: 0px
bottom: 0px;
left: 2px;
right: inherit;
width: 400px;
}
#map {
height: 512px;
@@ -42,10 +45,7 @@
div: "map",
projection: "EPSG:900913",
displayProjection: "EPSG:4326",
units: "m",
numZoomLevels: 18,
maxResolution: 156543.0339,
maxExtent: [-20037508, -20037508, 20037508, 20037508],
numZoomLevels: 18
});
// create Google Mercator layers

View File

@@ -31,11 +31,7 @@
function init(){
var options = {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34)
displayProjection: new OpenLayers.Projection("EPSG:4326")
};
map = new OpenLayers.Map('map', options);
var mapnik = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");

View File

@@ -38,9 +38,6 @@ function init() {
map = new OpenLayers.Map('map', {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
maxResolution: 20037508.34 / 128,
maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508),
restrictedExtent: extent,
controls: [
new OpenLayers.Control.PanZoom(),

View File

@@ -7,12 +7,7 @@ function init() {
var mercator = new OpenLayers.Projection("EPSG:900913");
map = new OpenLayers.Map('map', {
projection: mercator,
units: "m",
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(
-20037508, -20037508, 20037508, 20037508
)
projection: mercator
});
var g = new OpenLayers.Layer.Google("Google Layer", {

View File

@@ -47,12 +47,7 @@ function init() {
map = new OpenLayers.Map({
div: "map",
projection: "EPSG:900913",
units: "m",
maxExtent: new OpenLayers.Bounds(
-20037508.34, -20037508.34, 20037508.34, 20037508.34
),
maxResolution: 156543.0339
projection: "EPSG:900913"
});
var osm = new OpenLayers.Layer.OSM();

View File

@@ -5,12 +5,7 @@ function init() {
map = new OpenLayers.Map({
div: "map",
projection: "EPSG:900913",
units: "m",
maxExtent: new OpenLayers.Bounds(
-20037508.34, -20037508.34, 20037508.34, 20037508.34
),
maxResolution: 156543.0339
projection: "EPSG:900913"
});
var osm = new OpenLayers.Layer.OSM();

View File

@@ -4,12 +4,7 @@ function init() {
map = new OpenLayers.Map({
div: "map",
projection: "EPSG:900913",
units: "m",
maxExtent: new OpenLayers.Bounds(
-20037508.34, -20037508.34, 20037508.34, 20037508.34
),
maxResolution: 156543.0339
projection: "EPSG:900913"
});
var osm = new OpenLayers.Layer.OSM();

View File

@@ -19,7 +19,7 @@
var layerExtent = new OpenLayers.Bounds( -13758743.4295939, 5591455.28887228, -13531302.3472101 , 5757360.4178881);
map = new OpenLayers.Map( 'map', {'restrictedExtent': layerExtent} );
layer = new OpenLayers.Layer.XYZ( "ESRI",
"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/ESRI_LandBase_WebMercator/MapServer/tile/${z}/${y}/${x}",
"http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/${z}/${y}/${x}",
{sphericalMercator: true} );
map.addLayer(layer);
map.zoomToExtent(map.restrictedExtent);
@@ -33,7 +33,7 @@
XYZ, layer, tile
</div>
<div id="shortdesc">Show a Simple ESRI map using the layer from <a href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/ESRI_LandBase_WebMercator/MapServer">ESRI's server</a>. </div>
<div id="shortdesc">Show a Simple ESRI map using the layer from <a href="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer">ESRI's server</a>. </div>
<div id="map" class="smallmap"></div>