Custum map from Geoserver

Jel 2 years ago

Hello

Please i am using my map from geoserver calling it with this URL :

http://my.domaine.name:8080/geoserver/gwc/service/tms/1.0.0/urba%3AMaroc/{z}/{x}/{-y}.png

and whene i try to show the map on my app show me that cros origin error

Access to fetch at 'http://XX.XX.XX.XX:8080/geoserver/gwc/service/tms/1.0.0/urba%3AMaroc/1/0/%7B-y%7D.png' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

and whene i go to map layer i find it on red and can't select it

Anton Tananaev 2 years ago

Looks like your geoserver requires CORS. That's exactly what the error is tell you. You need to disable CORS requirement.

Jel 2 years ago

Hello @Anton Tananaev

Thanks for you answer please where i will disable it i install geoserver in a Ubuntu VM and i make search but didn't find where i will disable it

Anton Tananaev 2 years ago

I don't know. That's something to ask on the support channels for the geoserver.

Jel 2 years ago

Hello @Anton
Thanks so much for your asnwer i make some search and activate cors & it work fine
But whene i call my URL map the map showed in traccar deformed and can see my device in the correct location

Anton Tananaev 2 years ago

It probably means that the format is not right.

Jel 2 years ago

i test it in Qgis and it show fine but whene i try to using in traccar not show right

Jel 2 years ago

Please Anton if yoy can check that if it can work for you :

http://54.36.17.188:8080/geoserver/gwc/service/tms/1.0.0/urba%3AMaroc/{z}/{x}/{-y}.png

it work for me on Qgis but in the app she give me e deformed map

Anton Tananaev 2 years ago

It looks like it's in TMS format, which is not compatible.

Jel 2 years ago

so please wich format i can use ?

Anton Tananaev 2 years ago

It should be compatible with OSM. Not sure what the format is called.