Skip to content

Commit

Permalink
1.Tile.js中的Image,增加crossOrigin属性的设置,解决跨域问题。
Browse files Browse the repository at this point in the history
2.Proj中的toLonLat和fromLonLat删掉prototype
  • Loading branch information
radi-ac committed Oct 20, 2016
1 parent 6892a90 commit dddbf8c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/all/map/map_init.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
new GeoBeans.Layer.TileLayer({
name : "world",
source : new GeoBeans.Source.Tile.QuadServer({
url : "/QuadServer/maprequest",
url : "http://ourgis.digitalearth.cn/QuadServer/maprequest",
imageSet : "world_image"
}),
opacity : 1.0,
Expand Down
2 changes: 2 additions & 0 deletions src/GeoBeans/Layer/Tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ GeoBeans.Tile.prototype.load = function(){

if(!isValid(this.image)){
this.image = new Image();
this.image.crossOrigin = "Anonymous";

}

var that = this;
Expand Down
4 changes: 2 additions & 2 deletions src/GeoBeans/Proj.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PROJ_CONSTANT= EARTH_RADIUS * Math.PI / 180.0;
* @return {GeoBeans.Geometry.Point} 平面坐标点
* @public
*/
GeoBeans.Proj.prototype.fromLonLat = function(lon, lat){
GeoBeans.Proj.fromLonLat = function(lon, lat){

var x = lon * PROJ_CONSTANT;
var y = Math.log(Math.tan((90+lat)*Math.PI/360))/(Math.PI/180);
Expand All @@ -43,7 +43,7 @@ GeoBeans.Proj.prototype.fromLonLat = function(lon, lat){
* @returns {GeoBeans.Geometry.Point} 经纬度坐标点
* @public
*/
GeoBeans.Proj.prototype.toLonLat = function(x, y){
GeoBeans.Proj.toLonLat = function(x, y){

var lon = x / PROJ_CONSTANT;
var lat = y / PROJ_CONSTANT;
Expand Down
3 changes: 2 additions & 1 deletion src/GeoBeans/Source/Tile/OpenStreetMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
*/
GeoBeans.Source.Tile.OSM = GeoBeans.Class(GeoBeans.Source.Tile,{

_url : "/osm/",
//_url : "/osm/",
_url : "http://a.tile.openstreetmap.org/",
_imageSet : null,
_srs : GeoBeans.Proj.WebMercator,
_isWGS84 : false,
Expand Down

0 comments on commit dddbf8c

Please sign in to comment.