- Posts: 4
- Thank you received: 0
Custom Map Types
- RB
- Topic Author
- Offline
- New Member
Less
More
12 years 7 months ago #442
by RB
Custom Map Types was created by RB
How can I add Yandex satellite as a Custom Map Type?
Thanks for reply.
Thanks for reply.
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
12 years 7 months ago #443
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Re: Custom Map Types
Hi.
You can create a custom map type with Projection.
The tutorial how to create
zhuk.cc/wiki/index.php/Zh_GoogleMap_CustomMapType
You can create a custom map type with Projection.
The tutorial how to create
zhuk.cc/wiki/index.php/Zh_GoogleMap_CustomMapType
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.
- RB
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
12 years 7 months ago #446
by RB
Replied by RB on topic Re: Custom Map Types
OK.
I post
function(coord, zoom) {
return "http://vec0"+((coord.x+coord.y)%5)+".maps.yandex.net/tiles?l=map&v=2.16.0&x=" +
coord.x + "&y=" + coord.y + "&z=" + zoom + "";
},
to Get Tile URL function.
Global scope:
var MERCATOR_RANGE = 256;
function degreesToRadians(deg) {
return deg * (Math.PI / 180);
}
function radiansToDegrees(rad) {
return rad / (Math.PI / 180);
}
Projection scope:
this.pixelOrigin_ = new google.maps.Point(128,128);
this.pixelsPerLonDegree_ = MERCATOR_RANGE / 360;
this.pixelsPerLonRadian_ = MERCATOR_RANGE / (2 * Math.PI);
The Projection.fromLatLngToPoint() method:
YandexProjection.prototype.fromLatLngToPoint = function(latLng) {
var me = this;
var point = new google.maps.Point(0, 0);
var origin = me.pixelOrigin_;
var siny = bound(Math.sin(degreesToRadians(latLng.lat())), -0.9999, 0.9999);
point.x = origin.x + latLng.lng() *me.pixelsPerLonDegree_;
var exct = 0.0818197;
var z = Math.sin(latLng.lat()/180*Math.PI);
point.y = Math.abs(origin.y - me.pixelsPerLonRadian_*(atanh(z)-exct*atanh(exct*z)));
return point;
};
And The Projection.fromPointToLatLng() method:
YandexProjection.prototype.fromPointToLatLng = function(point) {
var me = this;
var origin = me.pixelOrigin_;
var lng = (point.x - origin.x) / me.pixelsPerLonDegree_;
var latRadians = (point.y - origin.y) / -me.pixelsPerLonRadian_;
var lat = Math.abs((2*Math.atan(Math.exp(latRadians))-Math.PI/2)*180/Math.PI);
var Zu = lat/(180/Math.PI);
var Zum1 = Zu+1;
var exct = 0.0818197;
var yy = -Math.abs(((point.y)-128));
while (Math.abs(Zum1-Zu)>0.0000001){
Zum1 = Zu;
Zu = Math.asin(1-((1+Math.sin(Zum1))*Math.pow(1-exct*Math.sin(Zum1),exct))
/(Math.exp((2*yy)/-(256/(2*Math.PI)))*Math.pow(1+exct*Math.sin(Zum1),exct)));
}
if (point.y>256/2) {lat=-Zu*180/Math.PI}
else {lat=Zu*180/Math.PI}
return new google.maps.LatLng(lat, lng);
};
so, you can tell me, what am I doing wrong?
I post
function(coord, zoom) {
return "http://vec0"+((coord.x+coord.y)%5)+".maps.yandex.net/tiles?l=map&v=2.16.0&x=" +
coord.x + "&y=" + coord.y + "&z=" + zoom + "";
},
to Get Tile URL function.
Global scope:
var MERCATOR_RANGE = 256;
function degreesToRadians(deg) {
return deg * (Math.PI / 180);
}
function radiansToDegrees(rad) {
return rad / (Math.PI / 180);
}
Projection scope:
this.pixelOrigin_ = new google.maps.Point(128,128);
this.pixelsPerLonDegree_ = MERCATOR_RANGE / 360;
this.pixelsPerLonRadian_ = MERCATOR_RANGE / (2 * Math.PI);
The Projection.fromLatLngToPoint() method:
YandexProjection.prototype.fromLatLngToPoint = function(latLng) {
var me = this;
var point = new google.maps.Point(0, 0);
var origin = me.pixelOrigin_;
var siny = bound(Math.sin(degreesToRadians(latLng.lat())), -0.9999, 0.9999);
point.x = origin.x + latLng.lng() *me.pixelsPerLonDegree_;
var exct = 0.0818197;
var z = Math.sin(latLng.lat()/180*Math.PI);
point.y = Math.abs(origin.y - me.pixelsPerLonRadian_*(atanh(z)-exct*atanh(exct*z)));
return point;
};
And The Projection.fromPointToLatLng() method:
YandexProjection.prototype.fromPointToLatLng = function(point) {
var me = this;
var origin = me.pixelOrigin_;
var lng = (point.x - origin.x) / me.pixelsPerLonDegree_;
var latRadians = (point.y - origin.y) / -me.pixelsPerLonRadian_;
var lat = Math.abs((2*Math.atan(Math.exp(latRadians))-Math.PI/2)*180/Math.PI);
var Zu = lat/(180/Math.PI);
var Zum1 = Zu+1;
var exct = 0.0818197;
var yy = -Math.abs(((point.y)-128));
while (Math.abs(Zum1-Zu)>0.0000001){
Zum1 = Zu;
Zu = Math.asin(1-((1+Math.sin(Zum1))*Math.pow(1-exct*Math.sin(Zum1),exct))
/(Math.exp((2*yy)/-(256/(2*Math.PI)))*Math.pow(1+exct*Math.sin(Zum1),exct)));
}
if (point.y>256/2) {lat=-Zu*180/Math.PI}
else {lat=Zu*180/Math.PI}
return new google.maps.LatLng(lat, lng);
};
so, you can tell me, what am I doing wrong?
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
12 years 7 months ago - 12 years 7 months ago #447
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Re: Custom Map Types
Add http://
In the end do not write ,
In Global scope you have to add two functions
The Projection.fromLatLngToPoint() method
and
The Projection.fromPointToLatLng() method
starts with function , you do not enter
or
And note: Yandex.Maps API resticts using it's tiles without API.
May be you should use Zh YandexMap extension
Code:
function(coord, zoom) {
return "http://vec0"+((coord.x+coord.y)%5)+".maps.yandex.net/tiles?l=map&v=2.16.0&x=" +
coord.x + "&y=" + coord.y + "&z=" + zoom + "";
}
In the end do not write ,
In Global scope you have to add two functions
Code:
function atanh(x) {
return 0.5*Math.log((1+x)/(1-x));
}
function bound(value, opt_min, opt_max) {
if (opt_min != null) value = Math.max(value, opt_min);
if (opt_max != null) value = Math.min(value, opt_max);
return value;
}
The Projection.fromLatLngToPoint() method
and
The Projection.fromPointToLatLng() method
starts with function , you do not enter
Code:
YandexProjection.prototype.fromPointToLatLng =
Code:
YandexProjection.prototype.fromLatLngToPoint =
And note: Yandex.Maps API resticts using it's tiles without API.
May be you should use Zh YandexMap extension
Don't forget support my developments: post review in JED , donate , help with translation
Last edit: 12 years 7 months ago by Dima.
Please Log in or Create an account to join the conversation.
- RB
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
12 years 7 months ago #452
by RB
Replied by RB on topic Re: Custom Map Types
Thanks a lot.
now yandex map can be loaded
so Yandex satellite or hybrid tiles can`t be loaded on Zh GoogleMap?
and if so, is it possible to load Google satellite or hybrid tiles with Zh YandexMap?
now yandex map can be loaded
so Yandex satellite or hybrid tiles can`t be loaded on Zh GoogleMap?
and if so, is it possible to load Google satellite or hybrid tiles with Zh YandexMap?
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
12 years 7 months ago #453
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Re: Custom Map Types
Read Yandex Maps API description about using.
And read Google Maps API description.
You can visit yandex maps club and search answers for you question.
You are not allowed use tiles without API. It is as for Yandex, as for Google. May be I mistake
As for using Google's tiles in Yandex. This task was solved in yandex maps club. As in google maps - you have to use projection.
Zh YandexMap now doesn't support user map types, as a projection too. It will be done in future releases.
I think you just decide what API you want to use.
Google's API have more features. Yandex - has PMAP
And read Google Maps API description.
You can visit yandex maps club and search answers for you question.
You are not allowed use tiles without API. It is as for Yandex, as for Google. May be I mistake
As for using Google's tiles in Yandex. This task was solved in yandex maps club. As in google maps - you have to use projection.
Zh YandexMap now doesn't support user map types, as a projection too. It will be done in future releases.
I think you just decide what API you want to use.
Google's API have more features. Yandex - has PMAP
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.
Time to create page: 0.188 seconds