Skip to content

Commit

Permalink
Merge branch 'master' of github.com:openlayers/openlayers
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Apr 3, 2012
2 parents 48a2d02 + 5309525 commit fef8b98
Show file tree
Hide file tree
Showing 288 changed files with 1,445 additions and 749 deletions.
File renamed without changes.
10 changes: 5 additions & 5 deletions build/license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

OpenLayers.js -- OpenLayers Map Viewer Library

Copyright 2005-2011 OpenLayers Contributors, released under the FreeBSD
license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt
for the full text of the license.
Copyright (c) 2006-2012 by OpenLayers Contributors
Published under the 2-clause BSD license.
See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors.

Includes compressed code under the following licenses:

(For uncompressed versions of the code used please see the
OpenLayers SVN repository: <http://openlayers.org/>)
(For uncompressed versions of the code used, please see the
OpenLayers Github repository: <https://github.com/openlayers/openlayers>)

*/

Expand Down
49 changes: 0 additions & 49 deletions doc/customization

This file was deleted.

7 changes: 0 additions & 7 deletions doc/readme.txt

This file was deleted.

Binary file added examples/data/tazdem.tiff
Binary file not shown.
32 changes: 32 additions & 0 deletions examples/fusiontables.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers Example For Reading Features From Google Fusion Tables</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<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">
<script src="../lib/OpenLayers.js"></script>
</head>
<body>
<h1 id="title">Reading Features From A Google Fusion Tables Table</h1>
<div id="tags">
protocol, script, fusion tables
</div>
<p id="shortdesc">
Demonstrates how, with a custom read method, the script protocol and GeoJSON format can be used to read features stored in a table on Google Fusion Tables.
</p>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>
Google Fusion Tables can be used to store features, and access them using SQL-type commands over HTTP. Tables can be made public, in which case no authorization is needed to read them. Geometries can be stored in Location columns in KML format. The default output is a CSV dump of each table row/column selected. Multi-line CSV files are not easy to parse in Javascript, but by adding a jsonCallback parameter to the HTTP command, the output will be a JSON object with the geometry as GeoJSON. With a custom read method, this example parses the geometry for each row, storing the other columns as feature attributes. You can of course add a 'where' clause to the SQL statement or change the column names to limit the data retrieved. Point geometries can also be stored in Latitude/Longitude columns, and the script could easily be modified to use those instead.
</p>
<p>
View the <a href="fusiontables.js" target="_blank">fusiontables.js</a>
source to see how this is done. <a href="https://www.google.com/fusiontables/DataSource?docid=1g5DrXcdotCiO_yffkdW0zhuJk0a1i80SPvERHI8">Table used</a>
</p>
</div>
<script src="fusiontables.js"></script>
</body>
</html>
46 changes: 46 additions & 0 deletions examples/fusiontables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
var map = new OpenLayers.Map({
div: "map",
layers: [
new OpenLayers.Layer.OSM(),
new OpenLayers.Layer.Vector("Vectors", {
projection: new OpenLayers.Projection("EPSG:4326"),
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.Script({
url: "https://www.google.com/fusiontables/api/query",
params: {sql: "select * from 1g5DrXcdotCiO_yffkdW0zhuJk0a1i80SPvERHI8"},
format: new OpenLayers.Format.GeoJSON({
ignoreExtraDims: true,
read: function(json) {
var row, feature, atts = {}, features = [];
var cols = json.table.cols; // column names
for (var i = 0; i < json.table.rows.length; i++) {
row = json.table.rows[i];
feature = new OpenLayers.Feature.Vector();
atts = {};
for (var j = 0; j < row.length; j++) {
// 'location's are json objects, other types are strings
if (typeof row[j] === "object") {
feature.geometry = this.parseGeometry(row[j]);
} else {
atts[cols[j]] = row[j];
}
}
feature.attributes = atts;
// if no geometry, not much point in continuing with this row
if (feature.geometry) {
features.push(feature);
}
}
return features;
}
}),
callbackKey: "jsonCallback"
}),
eventListeners: {
"featuresadded": function () {
this.map.zoomToExtent(this.getDataExtent());
}
}
})
]
});
43 changes: 0 additions & 43 deletions examples/mapbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,6 @@
<title>OpenLayers MapBox Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<style>
.olControlAttribution {
bottom: 5px;
font-size: 9px;
}
div.olControlZoomPanel {
top: 10px;
left: 10px;
}
div.olControlZoomPanel .olControlZoomInItemInactive,
div.olControlZoomPanel .olControlZoomOutItemInactive {
background: rgba(0, 0, 0, 0.2);
position: absolute;
}
div.olControlZoomPanel .olControlZoomInItemInactive {
border-radius: 3px 3px 0 0;
}
div.olControlZoomPanel .olControlZoomOutItemInactive {
border-radius: 0 0 3px 3px ;
top: 20px;
}
div.olControlZoomPanel div:hover {
background: rgba(0, 0, 0, 0.5);
}
div.olControlZoomPanel .olControlZoomOutItemInactive:after ,
div.olControlZoomPanel .olControlZoomInItemInactive:after {
font-weight: bold;
content: '+';
font-size: 18px;
padding: 0 2px;
z-index: 2000;
color: #fff;
line-height: 1em;
}
div.olControlZoomPanel .olControlZoomOutItemInactive:after {
content: '–';
line-height: 0.9em;
padding: 0 5px;
}
div.olControlZoomPanel .olControlZoomToMaxExtentItemInactive {
display: none;
}
</style>
</head>
<body>
<h1 id="title">Basic MapBox OSM Example</h1>
Expand Down
9 changes: 5 additions & 4 deletions examples/mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ var streets = new OpenLayers.Layer.XYZ(
"http://c.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png",
"http://d.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png"
], {
attribution: "Tiles © <a href='http://mapbox.com/'>MapBox</a> | " +
"Data © <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> " +
attribution: "Tiles &copy; <a href='http://mapbox.com/'>MapBox</a> | " +
"Data &copy; <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> " +
"and contributors, CC-BY-SA",
sphericalMercator: true,
wrapDateLine: true,
transitionEffect: "resize",
buffer: 1,
numZoomLevels: 16
numZoomLevels: 17
}
);

Expand All @@ -26,7 +27,7 @@ var map = new OpenLayers.Map({
enableKinetic: true
}
}),
new OpenLayers.Control.ZoomPanel(),
new OpenLayers.Control.Zoom(),
new OpenLayers.Control.Permalink({anchor: true})
],
center: [0, 0],
Expand Down
2 changes: 1 addition & 1 deletion examples/proxy.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ allowedHosts = ['www.openlayers.org', 'openlayers.org',
'prototype.openmnnd.org', 'geo.openplans.org',
'sigma.openplans.org', 'demo.opengeo.org',
'www.openstreetmap.org', 'sample.azavea.com',
'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080',
'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080',
'vmap0.tiles.osgeo.org', 'www.openrouteservice.org',
'maps.wien.gv.at']

Expand Down
84 changes: 59 additions & 25 deletions examples/strategy-bbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,53 +10,83 @@
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map, photos;
OpenLayers.ProxyHost = (window.location.host == "localhost") ?
"/cgi-bin/proxy.cgi?url=" : "proxy.cgi?url=";


/**
* A specific format for parsing Flickr API JSON responses.
*/
OpenLayers.Format.Flickr = OpenLayers.Class(OpenLayers.Format, {
read: function(obj) {
if(obj.stat === 'fail') {
throw new Error(
['Flickr failure response (',
obj.code,
'): ',
obj.message].join(''));
}
if(!obj || !obj.photos ||
!OpenLayers.Util.isArray(obj.photos.photo)) {
throw new Error(
'Unexpected Flickr response');
}
var photos = obj.photos.photo, photo,
x, y, point,
feature, features = [];
for(var i=0,l=photos.length; i<l; i++) {
photo = photos[i];
x = photo.longitude;
y = photo.latitude;
point = new OpenLayers.Geometry.Point(x, y);
feature = new OpenLayers.Feature.Vector(point, {
title: photo.title,
img_url: photo.url_s
});
features.push(feature);
}
return features;
}
});

function init() {
map = new OpenLayers.Map('map', {
restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90)
});
var base = new OpenLayers.Layer.WMS("Imagery",
["http://t1.hypercube.telascience.org/tiles?",
"http://t2.hypercube.telascience.org/tiles?",
"http://t3.hypercube.telascience.org/tiles?",
"http://t4.hypercube.telascience.org/tiles?"],
{layers: 'landsat7'}
);
map = new OpenLayers.Map('map');

var base = new OpenLayers.Layer.OSM();

var style = new OpenLayers.Style({
externalGraphic: "${img_url}",
pointRadius: 30
});

photos = new OpenLayers.Layer.Vector("Photos", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.HTTP({
url: "http://labs.metacarta.com/flickrbrowse/flickr.py/flickr",
projection: "EPSG:4326",
strategies: [new OpenLayers.Strategy.BBOX({resFactor: 1})],
protocol: new OpenLayers.Protocol.Script({
url: "http://api.flickr.com/services/rest",
params: {
format: "WFS",
sort: "interestingness-desc",
service: "WFS",
request: "GetFeatures",
srs: "EPSG:4326",
maxfeatures: 10
api_key: 'b5e8c0e287e678671c3d8b2c0f3ced85',
format: 'json',
method: 'flickr.photos.search',
extras: 'geo,url_s',
per_page: 10,
page: 1
},
format: new OpenLayers.Format.GML()
callbackKey: 'jsoncallback',
format: new OpenLayers.Format.Flickr()
}),
styleMap: new OpenLayers.StyleMap(style)
});

map.addLayers([base, photos]);
map.setCenter(new OpenLayers.LonLat(-116.45, 35.42), 5);
map.setCenter(
new OpenLayers.LonLat(-567468.5392481,
4950672.5471436), 5);
}

</script>
</head>
<body onload="init()">
<h1 id="title">BBOX Strategy Example</h1>
<div id="tags">
vector, feature, stylemap, wfs, bbox, strategy, cleanup
vector, feature, stylemap, bbox, strategy, script, flickr
</div>
<p id="shortdesc">
Uses a BBOX strategy to request features within a bounding box.
Expand All @@ -67,6 +97,10 @@ <h1 id="title">BBOX Strategy Example</h1>
previously requested data bounds are invalidated (by browsing to
some area not covered by those bounds), another request for data
is issued.</p>

<p>This particular example uses the <a
href="http://www.flickr.com/services/api/">Flickr API.</a></p>

</div>
</body>
</html>
Loading

0 comments on commit fef8b98

Please sign in to comment.