Local tile server "file:///C:\Traccar\{z}\{x}\{y}.png" support

grovkillen7 years ago

Hi,

I'm new to Traccar and are planning to use it for my hunting team. We want to keep track of our dogs and each other. Right now we rely on Avenza Maps and compiled maps using QGIS. My plan was to use the QTiles plugin to export tiles to my local machine which I run Traccar server on and have them up and running in no time. But I think local files are not supported when it comes to Custom Maps? Am I wrong or is it possible to add support for this?

I have all the png files in the suggested order (I think?). Feel free to contact me if you want more information.

Thanks for the feedback.


nor file:///C:\Traccar{z}{x}{y}.png or file:///C:/Traccar/{z}/{x}/{y}.png is working.

Anton Tananaev7 years ago

I have never tried to use local files. If it doesn't work, you can just put your tiles under "web" folder and it will be server by Traccar embedded web server.

grovkillen7 years ago

Thanks for the feedback. What syntax should I use to get access of the tiles? I have put them in my "web" folder and use the folder name "OwnTiles" with the sub-folder structure as {z}{x}{y}.png

I have tried to use this URL http://localhost:8082/OwnTiles/{z}/{x}/{y}.png and localhost:8082/OwnTiles/{z}/{x}/{y}.png but none work.

Anton Tananaev7 years ago

I think the first URL should work if you did everything else correctly. You should probably check browser developer console for more details. Especially network requests to tile server.

grovkillen7 years ago

Thanks for the quick feedback. The files are found if I manually browse then using a browser. I do get this warning:


Resource interpreted as Document but transferred with MIME type image/png: "http://localhost:8082/OwnTiles/13/4459/2234.png".

Is this a problem I need to fix?

Anton Tananaev7 years ago

You get this warning when you browse manually or in Traccar web app?

grovkillen7 years ago

I get this warning in the developer console (browsing manually).

Anton Tananaev7 years ago

If there are no warnings when you use web app, then it should work.

grovkillen7 years ago

I will export more tiles and see if they are not named with correct coordinates.

grovkillen7 years ago

It works just great! Thanks for the help. The problem was the zoom levels. I only exported z13-z18 but had zoom 12 when I did the tests. :S

grovkillen7 years ago

The only downside is that the custom map cannot be loaded as "localhost" on a remote device since the remote device download the tiles directly and not from the Traccar server. I use dyndns to resolve this but it would be great if it was possible to have the tiles downloaded from the Traccar server direct. :)

Anton Tananaev7 years ago

Maybe you can just use relative path without host:

/OwnTiles/{z}/{x}/{y}.png
grovkillen7 years ago

That did it! Thank you so much. :)

kurma7 years ago

hi grovkillen, i was searching to solve this problem for several days. would you share the directory structure where the .png files were saved to load to web browser?
for example file:///C:/mytiles/{z}/{x}/{y}.png files, i changed to http://localhost:8080/mytiles/{z}/{x}/{y}.png in web index.html file, http://localhost:8080/mytiles/
as traccar custom url , but i could not see any map... please give some tip..

kurma7 years ago

sorry to inform i am using apache tomcat server 8,