I have a fairly long (~100kb) kml file with polygons from around the world. Without the KML file loaded, the map plugin nicely shows me the whole world. However, as soon as I tell the component to display the KML, the zoom level is ignored, and the map zooms way out, showing the world several times. see e.g. http://draft.marinehotspots.org/hotspot ... s-map.html (test/test, if asked).
No matter what zoom level I set it on, this happens. I have set it to start at lat/long 0/0 (equator, Greenwich) within Phoca, and tried zoom levels from 0 to 14. This is on the latest version of Joomla 3.x with the latest Phoca Maps plugin and component.
Unfortunately, the KML is too long to paste here, due to character limits (it's about 100kb of plain text!), and I can't see any way of attaching the file to this post. I'm wary of adding another link in case this post is seen as "spammy" by the protection script.
I can manually set the zoom level once it loads (going two levels up from the bottom seems about right), but this is a bit clunky and looks (very) ugly on load.
I have my suspicions that this occurs because the polygons extend over the "edges" of the map (what with the globe being spherical and all), but I can't seem to figure out any way of "bounding" the view within KML or PhocaMaps.
Any ideas? Many thanks!
Phoca Maps does not obey zoom level with KML file
-
- Phoca Newbie
- Posts: 3
- Joined: 29 Jun 2014, 16:13
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Maps does not obey zoom level with KML file
Hi, I see.
In the html source code, you can see:
that the zoom is correctly set, so the only one idea is, something in the KML reset the default zoom level.
I see the KML in the source, so you don't need to add it here. There is no zoom settings but maybe this:
cuases that the zoom is set as it is (but maybe this should be some question on Google Maps API developer )
Jan
In the html source code, you can see:
Code: Select all
var phocaOptions = {
zoom: 14,
center: phocaLatLng,
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT,
position: google.maps.ControlPosition.TOP },
navigationControl: true,
navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT},
scaleControl: true,
scrollwheel: 1,
disableDoubleClickZoom: 0,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
I see the KML in the source, so you don't need to add it here. There is no zoom settings but maybe this:
Code: Select all
<LatLonAltBox>
<north>180</north>
<south>-180</south>
<east>-180</east>
<west>180</west>
</LatLonAltBox>
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 3
- Joined: 29 Jun 2014, 16:13
Re: Phoca Maps does not obey zoom level with KML file
Thanks Jan - the region and <LatLonAltBox> was my attempt (clearly not working!) to try to set the boundaries being displayed; the behaviour is the same whether or not it is in the .kml. I've edited it out again, and the problem remains.
I've submitted a question to StackOverflow
http://stackoverflow.com/questions/2459 ... oogle-maps
The KML (without the Region set) is available from http://pastebin.com/wqTXaq38
I've submitted a question to StackOverflow
http://stackoverflow.com/questions/2459 ... oogle-maps
The KML (without the Region set) is available from http://pastebin.com/wqTXaq38
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Maps does not obey zoom level with KML file
Ok
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 3
- Joined: 29 Jun 2014, 16:13
Re: Phoca Maps does not obey zoom level with KML file
"Sounds like you need the preserveViewport option of the KmlLayer"
According to one post on my StackOverflow submission
http://stackoverflow.com/questions/2459 ... oogle-maps
Does PhocaMaps already use preserveViewport?
https://developers.google.com/maps/docu ... er_options
Thanks!
According to one post on my StackOverflow submission
http://stackoverflow.com/questions/2459 ... oogle-maps
Does PhocaMaps already use preserveViewport?
https://developers.google.com/maps/docu ... er_options
Thanks!
- Jan
- Phoca Hero
- Posts: 48403
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Maps does not obey zoom level with KML file
Hi, no, there is no instruction for preserveViewport in the code, so the javascript code of the Phoca Maps needs to be customized
Jan
Jan
If you find Phoca extensions useful, please support the project