[Opensim-dev] leaflet for web map
ssm2017
ssm2017 at gmail.com
Tue Dec 15 09:52:48 UTC 2015
thank you Vitaly for your example but i was not able to make the map work.
the zoom is inverted so i have added the "zoomReverse: true" property to
the tileLayer and now the zoom is working fine but depending on the zoom
level some tiles are inverted and coordinates are getting crazy (reverted
zoom or not).
On Mon, Dec 14, 2015 at 5:31 PM, Виталий Фицнер <wchf at yandex.ru> wrote:
> Leaflet could use OpenSim tiles, but you need to set up custom projection,
> like this:
>
>
> <script>
>
> var mapMinZoom = 1;
> var mapMaxZoom = 6;
>
> L.Projection.Direct = {
> project: function (latlng) {
> return new L.Point(latlng.lat*256, latlng.lng*256);
> },
>
> unproject: function (point) {
> return new L.LatLng(point.x/256, point.y/256);
> }
> };
>
> L.CRS.OpenSim=L.extend({},L.CRS,{
> projection: L.Projection.Direct,
> transformation:new L.Transformation(1,0,1,0),
>
> scale: function (zoom) {
> return 1;// OpenSim zoom
> }
> });
>
>
> var map = L.map('map',{
> minZoom: mapMinZoom,
> maxZoom:mapMaxZoom,
> crs: L.CRS.OpenSim
> });
>
>
>
>
>
> map.setView([1000, 1000], 1);
>
> L.tileLayer('http://localhost:8002/map-{z}-{x}-{y}-objects.jpg', {
> maxZoom: mapMaxZoom,
> continuousWorld: true,
> noWrap:true,
> tileSize:256,
> crs: L.CRS.OpenSim,
> attribution: 'opensim',
> id: 'opensim',
> }).addTo(map);
>
> map.panTo([1000,1000]);
>
>
> </script>
>
> 14.12.2015, 17:04, "ssm2017" <ssm2017 at gmail.com>:
>
> hello
> i would like to create a web map using leaflet and the crs projection.
> i am not able to make something valuable.
> i have asked in the #leaflet channel and someone told me that
> OpenSimulator tiles (located in the Robust folder bin/maptiles) are weird.
> here is what the person told me :
> "if you have a tile, e.g. 1-1000-1000, make sure that the tiles
> 2-2000-2000, 2-2001-2000, 2-2000-2001 and 2-2001-2001 are the same thing,
> but 2x"
>
> my questions are :
> is this person right ?
> did someone was able to create a web map using leaflet and v2 tiles ? (and
> if yes, how :) )
> ,
>
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at opensimulator.org
> http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
>
>
>
> --
> Отправлено из быстрой почты
> http://mail.yandex.ru/neo2/collect/?exp=1&t=5
>
>
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at opensimulator.org
> http://opensimulator.org/cgi-bin/mailman/listinfo/opensim-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20151215/58282f1b/attachment.html>
More information about the Opensim-dev
mailing list