Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tileImge的crossOrigin问题 #826

Closed
AllanHao opened this issue Nov 23, 2018 · 10 comments
Closed

tileImge的crossOrigin问题 #826

AllanHao opened this issue Nov 23, 2018 · 10 comments

Comments

@AllanHao
Copy link
Contributor

maptalks v0.42.1

我请求瓦片数据报“ Access to image at 'xxx' from origin 'xxx' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource"的错,通过调试,
在TileLayerGLRenderer的loadTileImage函数中,有一句
tileImage.crossOrigin = this.layer.options['crossOrigin'] || '';
我把这句去掉就解决了。

通过调试openlayers源码,发现如果crossOrigin没有设置,没有赋默认值。

最后,感谢大神做出这么牛逼的地图库~~~

@fuzhenn
Copy link
Member

fuzhenn commented Nov 23, 2018

谢谢~ 方便提供一下出错的tile服务的url不?
我来看看这个问题

@AllanHao
Copy link
Contributor Author

wms地址:http://bj.smartmall.gaiais.com:8090/iserver/services/cacheMap_UGCV5_KB/wms111/全国数据
layerName:全国数据
坐标:EPSG:4326

@AllanHao
Copy link
Contributor Author

另外,我还有一个问题,marker可以设置三维效果的样式吗?比如立体效果的柱子,柱子添加阴影效果等,我参考的demo是http://maptalks.org/examples/cn/animation/marker-anim/#animation_marker-anim。
因为没有Symbol的所有属性字段含义,所以还请指点一下

@davidweining2333
Copy link
Contributor

image
我的项目里也有报错,但报错是因为确实没有这个瓦片,我觉得是浏览器识别为跨域导致的找不到

@davidweining2333
Copy link
Contributor

@fuzhenn 顺便问下关于crossOrigin的问题,项目中遇到离线访问地图服务的情况,因此会直接把切片放到前端代码根目录,我通过file协议直接访问,此时为非跨域请求瓦片,无论我如何设置crossOrigin,图片请求的origin都是null,导致报跨域错误
image

@AllanHao
Copy link
Contributor Author

我的问题调用超图的iServer wms就不行,调用geoserver的就可以了,好奇怪。最后没有办法用geoserver重新发布了一遍iServer的wms服务

@fuzhenn
Copy link
Member

fuzhenn commented Nov 23, 2018

@AllanHao symbol的属性表(readme里有链接):
https://github.com/maptalks/maptalks.js/wiki/Symbol-Reference

crossOrigin出错估计是iServer对crossOrigin的支持和geoserver不同,我晚点会找时间看一下

@fuzhenn
Copy link
Member

fuzhenn commented Nov 24, 2018

噢,对了,三维的效果可以看一下maptalks.three插件

@AllanHao
Copy link
Contributor Author

@fuzhenn 好的,谢谢

@fuzhenn
Copy link
Member

fuzhenn commented Dec 23, 2018

image设置了crossOrigin属性后,超图服务会直接返回网络错误(net::ERR_FAILED),没有http错误码也没有任何报错信息,看上去是超图服务对crossOrigin的处理逻辑有bug。

我修改了一下程序,现在能通过手动把crossOrigin设成undefined(默认是null)来覆盖掉原有的crossOrigin默认值。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants