- Posts: 41
- Thank you received: 0
Tile URL-Function
- Pleppo
- Topic Author
- Offline
- Senior Member
Less
More
5 years 9 months ago #12149
by Pleppo
Tile URL-Function was created by Pleppo
Hello,
how does this Tile URL function look like?
Is there perhaps a code as an example?
And if I want to show a grid over the map, is that also possible?
For example this Javascript: openlayers.org/en/latest/examples/canvas-tiles.html
many Greetings
P.
how does this Tile URL function look like?
Is there perhaps a code as an example?
And if I want to show a grid over the map, is that also possible?
For example this Javascript: openlayers.org/en/latest/examples/canvas-tiles.html
many Greetings
P.
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
5 years 9 months ago #12152
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Tile URL-Function
Hi.
If you have tile provider, which has tiles, for example, with getTileFunction - yes, you can create your custom map overlay type.
As in this example - no, I didn't implement projection yet.
If you have tile provider, which has tiles, for example, with getTileFunction - yes, you can create your custom map overlay type.
As in this example - no, I didn't implement projection yet.
Don't forget support my developments: post review in JED , donate , help with translation
Please Log in or Create an account to join the conversation.
- Pleppo
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 0
5 years 8 months ago #12214
by Pleppo
Replied by Pleppo on topic Tile URL-Function
Hi,
I now have all the necessary data (coordinates) in the MySQL database and could actually create paths for a MTB grid (1: 25,000) for my special state, which then lies as a layer over the OSM?
So I have the coordinates for every single MTB "tile" and can thus also create the measurement table leaf boundaries, if I can connect the data here with the map program?
Is that synonymous with a Tile URL function?
But does that formula look like then? I have a table in the multi-column database where the MTB numbers, names, corner coordinates, etc. are in it.
many Greetings
F.
I now have all the necessary data (coordinates) in the MySQL database and could actually create paths for a MTB grid (1: 25,000) for my special state, which then lies as a layer over the OSM?
So I have the coordinates for every single MTB "tile" and can thus also create the measurement table leaf boundaries, if I can connect the data here with the map program?
Is that synonymous with a Tile URL function?
But does that formula look like then? I have a table in the multi-column database where the MTB numbers, names, corner coordinates, etc. are in it.
many Greetings
F.
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
5 years 8 months ago #12216
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Tile URL-Function
OK.
Look a this example
bl.ocks.org/letmaik/e71eae5b3ae9e09f8aeb288c3b95230b
Is it what you want?
If yes - I can add GridLayer support to extension like this
Look a this example
bl.ocks.org/letmaik/e71eae5b3ae9e09f8aeb288c3b95230b
Is it what you want?
If yes - I can add GridLayer support to extension like this
Don't forget support my developments: post review in JED , donate , help with translation
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
5 years 8 months ago #12217
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Tile URL-Function
The difference only in one - y differs for 1
Because your URL - top left corner starts 0, -1
In my example - 0,0
But it doesn't matter. I'll add ability to your definition tile content, therefore just change a little formula.
Because your URL - top left corner starts 0, -1
In my example - 0,0
But it doesn't matter. I'll add ability to your definition tile content, therefore just change a little formula.
Don't forget support my developments: post review in JED , donate , help with translation
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
5 years 8 months ago - 5 years 8 months ago #12221
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Tile URL-Function
I did release.
zhuk.cc/2019/03/01/zh-openstreetmap-new-...-changed-to-v-1-4-0/
Check my example
joomla.zhuk.cc/index.php/zhosmmap-main/o...-feature-full-screen
Just create path, and in Grid Layer enter "Create Tile Function" field
It is a little bit different from my link above - I do substr to 10 symbols (9 for values and 1 is space), because in example you can see overflow longitude with not extra needed numbers after point.
And I don't show white rectangle (I commented lines), on which text is written
zhuk.cc/2019/03/01/zh-openstreetmap-new-...-changed-to-v-1-4-0/
Check my example
joomla.zhuk.cc/index.php/zhosmmap-main/o...-feature-full-screen
Just create path, and in Grid Layer enter "Create Tile Function" field
Code:
function(coords) {
var tile = L.DomUtil.create('canvas', 'leaflet-tile');
var ctx = tile.getContext('2d');
var size = this.getTileSize()
tile.width = size.x
tile.height = size.y
// calculate projection coordinates of top left tile pixel
var nwPoint = coords.scaleBy(size)
// calculate geographic coordinates of top left tile pixel
var nw = map.unproject(nwPoint, coords.z)
// will not create white background
//ctx.fillStyle = 'white';
//ctx.fillRect(0, 0, size.x, 50);
//ctx.fillStyle = 'black';
var vx = " " + coords.x;
var vy = " " + coords.y;
ctx.fillText('x:' + vx.substr(1, 10) + ', y:' + vy.substr(1, 10) + ', zoom: ' + coords.z, 20, 20);
vx = " " + nw.lat;
vy = " " + nw.lng;
ctx.fillText('lat:' + vx.substr(1, 10) + ', lon:' + vy.substr(1, 10), 20, 40);
ctx.strokeStyle = 'black';
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(size.x, 0);
ctx.lineTo(size.x, size.y);
ctx.lineTo(0, size.y);
ctx.closePath();
ctx.stroke();
return tile;
}
It is a little bit different from my link above - I do substr to 10 symbols (9 for values and 1 is space), because in example you can see overflow longitude with not extra needed numbers after point.
And I don't show white rectangle (I commented lines), on which text is written
Don't forget support my developments: post review in JED , donate , help with translation
Last edit: 5 years 8 months ago by Dima.
Please Log in or Create an account to join the conversation.
Time to create page: 0.219 seconds