shramov / leaflet-plugins Goto Github PK
View Code? Open in Web Editor NEWPlugins for Leaflet library
Home Page: http://psha.org.ru/b/leaflet-plugins.html
License: MIT License
Plugins for Leaflet library
Home Page: http://psha.org.ru/b/leaflet-plugins.html
License: MIT License
You should add an additional attribute to BingLayer options so that cultures can be selected. When using type "Road" or "AerialWithLabels" there are tiles with localized labels.
Permalink with useAnchor=false uses ? instead of # as delimiter between base URL and parameters. But the parameters are added twice ore more if Permalink is clicked again.
The cause is in _set_urlvars (lPermalink.js, line 98) where # is used regardless off the option useAnchor=true/false
BTW: thanks for your plugins!
I enhanced your leaflet Google plugin to also display Google Adsense ads. See http://test.mapsmarker.com/?p=30 for an example. The code for this example can be found here: https://gist.github.com/4463745
unfortunately, the links in the ad are not clickable, although I tried everything that came into my mind (changing z-index, removing controls etc).
I guess that this might be a more common issue, as the link "Report problems" from Google is also not working.
Any help on this is really appreciated! In case you have an idea, you could also earn 30$ on http://test.mapsmarker.com/?p=30, where I am also looking for a solution ;-)
Hello Shramov,
I tried using your KML plugin, but I've got a strange behavior.
First, I tried to use local leaflet and leaflet-plugin scripts, with a local HTML.
Then when I saw it didn't work, I copied your example at
http://psha.org.ru/leaflet-plugins/examples/kml.html
and put the exact same content at
http://www.tellnet.fr/blog/kmlsource.html,
just modifying the paths toward your files on your server.
Well, when I open yours, it works perfectly : it centers on USA and shows the markers.
When I open mine, it always center on Russia and never displays any marker.
I've got no errors anywhere. I'm not even sure it's related to your plugin, maybe it's related to the Leaflet JS, but I don't see what it can be.
Thank you very much in advance for your help.
PS : I'm a noob in JS.
PSS : I guess it's somehow related to these issues :
#43
#36
Hello,
amazing work
when adding markers to leaflet it renders find with OSM but when using google the markers are repositioned before the map repositions. I don't know if I done something wrong or it is a known issue
I also added Google Terrain in my plugin - please see www.mapsmarker.com, second map and switch in the layers control to google terrain. Problem is, that you cant move the map around - only the address overlay moves. With other Google map types, this works fine. Dave (https://github.com/robertharm/Leaflet-Maps-Marker/issues/31) ment that this has to to with missing max-zoom for terrain maps - so I added maxZoom:20 - but with no effect. Do you have any idea, why Google terrain maps dont work like the other ones?
Hi Shramov,
I load Google APIs via Google loader in my plugin www.mapsmarker.com by the code
wp_enqueue_script( 'leafletmapsmarker-googlemaps-loader', 'https://www.google.com/jsapi?key='.$google_maps_api_key, array(), NULL);
and load the maps module via leaflet.js where I added
google.load("maps", "3", {other_params:"sensor=false&language="+leafletmapsmarker_L10n.lmm_googlemaps_language+leafletmapsmarker_L10n.lmm_googlemaps_libraries});
A user now reported a strange error which I could verify here: http://beta.mapsmarker.com/?p=42
When you try to drag the map, only the markers are moved around and not the map itself.
This is because the theme from the user also connects to the Google Maps API via
wp_enqueue_script( 'google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false', array(), false, true );
Do you happen to know if this behaviour can be prevent by changing your Google Maps plugin code or do I have to dequeue other Google Maps JS calls (which I wouldnt prefer as the other scripts could use parameter which I dont use).
Any help is appreciated!
regards,
Robert
Hello Pavel,
First, thanks for the KML plugin. I really look forward to using it.
There's an issue when loading KML files that come from ESRi's systems (I think). Below is a link to such file, that causes an internal error in the plug in. The file loads on OpenLayers, GoogleEarth and a parser I wrote for iOS, so I guess it is OK(-ish?). I'm be happy to collaborate on this, as I'll be much happier using leaflet than the other options.
http://ec2-54-218-4-137.us-west-2.compute.amazonaws.com/assets/kmls/tour.kml
The error is on line 210 of KML.js:
TypeError: 'undefined' is not an object (evaluating 'el[0].childNodes[0].nodeValue')
Thanks,
Michael
Could it possible to enhance your leaflet Google Maps plugin to also display Google Earth view? Would be a great new feature!
do you have an idea, what to do with the shadow of an icon on rotate?
should it be retated, too?
deleted?
Or do you have another idea?
please see example:
http://customer2.mediafactory.de/
При компиляции исходников через http://closure-compiler.appspot.com/compile были ошибки до тех пор, пока в указанных файлах не добавил в конец указанных файлов точку с запятой ';'.
При использовании по отдельности файлов всё нормально работало
This code (used yandex.js and google.js plug-ins):
var map = L.map('map').setView([51.505, -0.09], 13);
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
var yndx = new L.Yandex();
var ggl = new L.Google();
map.addLayer(ggl);
map.addControl(new L.Control.Layers({ 'OSM': osm, "Yandex": yndx, "Google": ggl }));
var polygon = L.polygon([
[51.509, -0.08],
[51.503, -0.06],
[51.51, -0.047]
]).addTo(map);
Polygon is displayed on the screen while adding/loading layers very short time. Finally, polygon displayed only at OSM layer.
Object map._controlCorners['bottomright'] doesn't exist. But Object map._controlCorners['bottomRight'] does.
Old:
row 46: map._controlCorners['bottomright'].style.marginBottom = "1em";
row 59: map._controlCorners['bottomright'].style.marginBottom = "0em";
New:
row 46: map._controlCorners['bottomRight'].style.marginBottom = "1em";
row 59: map._controlCorners['bottomRight'].style.marginBottom = "0em";
в линейке косяк с удаление точек:
-создаем маршрут из >3 точек
-удаляем последнюю
-еще раз удаляем последнюю, получаем полупрозрачную точку висящую в воздухе
-а если еще и щелкнуть два раза на этой точке, получим вообще что-то странное
пробовал в опере и файерфоксе
http://forum.openstreetmap.org/viewtopic.php?pid=249507#p249507
var track = new L.KML("KML_Samples.kml", {async: true});
track.on("loaded", function(e) { alert("hi"); map.fitBounds(e.target.getBounds()); });
is it because i am testing it locally do i need to put it on a server? the alert is never called? i dont see the data from xml
Hi, when zomming in/out we can see the marker has a 'sliding' effect on the map, while on the osm layer, the marker stays stuck during the zoom animation. Is there a way to prevent this behavior ?
Check the sample here http://jsfiddle.net/jcocoder/fJFWN/4/
Regards
Yves.
granted the last commit is 6 month old ?
Hi shramov,
I wonder if you have any plans supporting Google Street View with your plugin / leaflet.
Would really be a great addition!
regards,
Robert
please set map zoom level to 22 for Google and Bing maps to 21 as it is supported by those...
we should add something like this:
http://forrst.com/posts/Object_getPrototypeOf_shim-eNB
or replace the function :-(
Any plans to add support for Bing's Birdseye?
I have tryed to hack a bit with no luck...
Hi, I have been trying to add a layer from a kml file without succes. I've tried many things but nothing works. I only have a simple card without any layer added. I would be thankful if you could help me. here is my html code:
<script src="Leaflet/leaflet.js"></script> <script src="leaflet-plugins/layer/vector/KML.js"></script> <script type="text/javascript" > function initmap() { // set up the map var map = new L.Map('map'); // create the tile layer with correct attribution var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; var osmAttrib='Map data © OpenStreetMap contributors'; map.attributionControl.setPrefix(''); // Don't show the 'Powered by Leaflet' text. var osm = new L.TileLayer(osmUrl, {minZoom: 2, maxZoom: 16, attribution: osmAttrib}); // start the map in France map.setView(new L.LatLng(45.4, 1.2),6); map.addLayer(osm); // add a kml layer var kmlLayer = new L.KML("offresRoute.kml", {async: true}); kmlLayer.on("loaded", function(e) { map.fitBounds(e.target.getBounds()); }); map.addLayer(kmlLayer); } </script>
TEXTE DIV
I have default marker rotated on 90 degrees and fixed like that.
var marker = new L.Marker([50, 80], { iconAngle: 90 });
map.addLayer(marker);
It works ok on static map, but when I zoom map in or out rotates back to 0 degrees. And after zoom transaction ends it rotates back to 90 degrees.
Hello, can you tell me the correct or at least the preferred way to get the data out of the KML?
I have something that looks like this in my KML:
<Folder>
<name>Events</name>
<open>1</open>
<Placemark>
<name>Lunch Special</name>
<LookAt>
<longitude>23.75231752313513</longitude>
<latitude>17.95077511438697</latitude>
<altitude>0</altitude>
<heading>-10.84185156357546</heading>
<tilt>0</tilt>
<range>10298789.70698782</range>
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
</LookAt>
<styleUrl>#m_ylw-pushpin0</styleUrl>
<Point>
<coordinates>23.75231752313513,17.95077511438697,0</coordinates>
</Point>
</Placemark>
and I'm really justr trying to get the out of it to be used. I see it's put into the popup as an h2 but i'd like to do something keyed against that...
e.target.eachLayer(function(outerLayer) {
outerLayer.eachLayer(function(innerLayer) {
console.log(innerLayer);
});
});
etc... but it seems kind of ridiculous, like there's probably a better way. Can you advise?
Hi Shramov,
it would be nice if the GPX and KML Layers will show markers for start resp. end of a track.
Roland
According to this, one should not be able to use the map outside of google's tools.
Yet, I can still do:
var road = new L.Google("ROADMAP");
or
var road = new L.Google("SATELLITE");
And get access to the map with either street or satellite view.
So I'm wondering, how are you doing it? By using the script, would I be actually breaking any rule?
Cheers, and thanks for this great tool mate!
getTileUrl: function (p, z) {
var z = this._getZoomForUrl();
var subdomains = this.options.subdomains,
s = this.options.subdomains[Math.abs((p.x + p.y) % subdomains.length)];
return this._url.replace('{subdomain}', s)
.replace('{quadkey}', this.tile2quad(p.x, p.y, z))
.replace('{culture}', '');
}
Fix is use Math.abs while calculating subdomains as shown above
On vector/KML.js (
leaflet-plugins/layer/vector/KML.js
Line 111 in 7ec7fd2
I think that this line should be :
options.color = "#" + value.substring(6, 8) + value.substring(4, 6) + value.substring(2, 4);
Ссылка на демо все та же - http://tinyurl.com/chyzsax . Если переключиться на Гугл и особенно на Яндекс - при перетягивании карты маркер перемещается, но с сильными такими тормозами. При этом на opencyclemap такого лага не наблюдается.
Ничего, что я по-русски?)
My map stopped working around 10 AM GMT today. I made no changes to the code and it's not loading any more. Anyone else having some issues?
Hi again,
I'm currently having an issue with google maps tile layer. I'm using danzel's Leaflet.markercluster plugin to cluster and display my markers.
Problem is that google maps layer displays on top of marker layer so it renders the map unusable because it's impossible to click on markers.
When I select different tile layer (e.g. Bing layer or OSM) markers are displayed as intended on top of the tile layers. But if google maps tile layer is selected it's again displayed above all else.
Is it possible to move google tile layer to front or to back by some method? I've tried bringToFront() but L.Google doesn't have that method.
I'm sorry that I cannot give you a link to my webpage for security reasons to see it for yourself.
What license is this code under? MIT?
We are using your plugin on wheelmap.org It workes quite nice, but there is one issue.
When clicking a permalink, panning the map and then clicking the permalink again produces an url like this:
http://wheelmap.org/map?zoom=14&lat=52.51893&lon=13.47121?zoom=14&lat=52.55829&lon=13.38503
What am i doing wrong?
При добавлении маркера на карту, маркер отображается только на OSM. На карте Yandex маркер не виден.
var map = L.map('map').setView([57,1], 13);
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
var layerdefs = {
ysat: { name: "Yandex", js: ["/scripts/tile/Yandex.js", "http://api-maps.yandex.ru/2.0/?load=package.map&lang=ru-RU"],
init: function() {return new L.Yandex("satellite"); }},
};
var yndx = new L.DeferredLayer(layerdefs.ysat);
map.addLayer(osm);
map.addControl(new L.Control.Layers({'OSM':osm, "Y":yndx},
{}));
L.marker([57,1]).addTo(map)
.bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup();
Привет. Во время интеграции возникла трабла - тайлов не видно http://tinyurl.com/chyzsax . При этом opencyclemap нормально отображается, а гуглокарты и яндекскарты - нет. Возможно как-то связанно с версткой на странице, но я не могу понять что не так.
Bing layers should provide correct attribution information.
You can check out my modification of your code at
to solve this problem.
Hi,
no sure what is going on, but the Google Maps layer does not work with Leaflet master as of 02/21/2013. It works fine with LL 0.5.1
The zoom buttons do not respond and if you zoom out using pinch zoom it also breaks.
I've added support for overlays in my project (sorry, no github pull request availabe).
It works using flags (T/F) for each overlay (e.g. ...&overlays=TFTT). Dynamically changing overlays in layer control will break it, because it relies on the sequence of the overlays in layer control.
It needs leaflet from github with merged pull request #1286 (layer control events for overlays): Leaflet/Leaflet#1286
Permalink.Overlay.js: http://pastebin.com/wChyR7bD
Feel free to reuse the code as you like!
Hi, i'm wondering if these recent changes in google terms of use can be problematics for the use of google tiles with leaflet ?
http://nateirwin.net/blog/google-imposing-more-restrictions-on-google-maps-api.html
This post is not here to generate a troll :)
Is it possible load maps api only when addLayer
/_initMapObject
called?
I cannot make it run. Even example does not show GPX.
It does not show any trace of problems except loaded GPX is not visible.
JavaScript Error Console shows no errors.
Other plugins from the pack work fine.
I also did not manage to display KML either using KML.js.
Is there problem with code or I am not smart enough to figure it out?
IMO the reason is: space characters of layer names get coded to %20 in a permalink-URL. So the names do not match any more and the first (default?) layer is choosen.
Hi Shramov,
first thanks a lot for your great plugins! I am the developer of http://www.mapsmarker.com and since 2.5 of my plugin I use your Google Maps leaflet plugin successfully (one hint: you could also add terrain as list of possible basemaps).
With v2.6 I also integrated bing maps support. I therefore trippled the classes as I wanted all type of bing maps to be available (ok their could be better ways doing this, but this was the easiest for me due to my lack of deep javascript knowledge ;-) See the file here: http://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/js/bing.js
When creating maps on admin backend, everything worked fine - no console errors, switching back and forth from other basemaps without problems. I made a v2.6 release and noticed (too late), that there are problems displaying bing maps with your plugin active on frontend. When calling the demo page (map 2 is bing map) on http://mapsmarker.com/bing, I am getting the following errors in the console:
TypeError: _bing_metadata is not a function
TypeError: _bing_metadata2 is not a function
TypeError: _bing_metadata3 is not a function
Sometimes also switching from bing basemaps to other basemaps doesnt work (cant be reproduced everytime) .
As said before, this only occurs on frontend and not within the admin area. I checked twice (or more often) - the implemenation of bing.js is the same on frontend as on backend.
As v2.6 with bing maps support is already out (although not enabled by default), I kindly ask you to help me solving this issue. Any help is really appreciated and I will give you proper credits within the plugin and on my websites (I already linked your plugin page within the plugins credits & help section).
Looking forward to hearing from you!
Robert
Hi Shramov,
I just try to upgrade my plugin mapsmarker.com (integrated with your plugin) to leaflet v0.4.3. Unfortunately bing maps dont show up anymore. I couldnt figure out if the error is caused by my plugin or if by bing.js.
Can you please tell me, if your current code is compatible with leaflet v0.4.4?
many thanks in advance for your help!
Robert
trying to use both Distance.js and leaflet.zoomfs plugin - in fullscreen mode the distance measure works very strange... new points sets not under the mouse pointer...
Hi shramov,
a user of my plugin reported that Google Maps cannot be displayed with IE7. Can you please tell me if your plugin is IE7 compatible? would help me a lot where to look for a fix...
best regards,
Robert
Hello there,
google.html from examples folder is working pretty good, but once I indicated the doc as HTML5 then the Google tile will not load any more. I have filed a snippet at https://gist.github.com/3968924 then you could play it around by defining it as HTML5 type to see what will happen.
I did test against Chrome v22 & Safari v5.1.7
Thank you for your time.
/Xinyu
show polygones with outerBoundaryIs LinearRing
Could you tag a 0.1 version of this or something so that other projects that depend on it have some sort of "stable" version to use? In a corporate environment it's difficult to say, "just use the latest version of everything" 😦
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.