KML file zoom size

Phoca Maps - displaying maps in Joomla! CMS
TenX
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 30 Aug 2016, 22:10

KML file zoom size

Post by TenX »

Hi,
I created a kml file in Google Earth Pro and uploaded it to my server. Works fine and displays, but now I can't set the Zoom level in the Phoca Maps. Its opens to a default zoom that i can't control. Is there a fix for this?
Thanks.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: KML file zoom size

Post by Jan »

Hi, if you load the KML, then you should set the zoom in KML :idea:

Jan
If you find Phoca extensions useful, please support the project
myaso1488
Phoca Member
Phoca Member
Posts: 11
Joined: 29 Jul 2016, 13:53

Re: KML file zoom size

Post by myaso1488 »

No! I have same problem. In KML file i cant find ZOOM paremeter.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: KML file zoom size

Post by Jan »

Hi, and as in the first post, you cannot set the zoom in map? (edit of map in Phoca Maps administration?)
See: https://www.phoca.cz/joomlademo/phoca-maps-kml - zoom is set in Map
Jan
If you find Phoca extensions useful, please support the project
myaso1488
Phoca Member
Phoca Member
Posts: 11
Joined: 29 Jul 2016, 13:53

Re: KML file zoom size

Post by myaso1488 »

i can set 3,5,6,7,8 zoom level in administrator panel. But! Maps with marker initialized first with right zoom, but after load kml file - zoom out.
so. My kml file - all world. From America to Japan. With my map widht not all world u can watch. Bu its ok. I can see part of america.
And i set normal zoom and great center position.
KML file i thik wanna see ALL kml objects and set zoom level to 1
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: KML file zoom size

Post by Jan »

Hmmm, hard to say, testing here: https://www.phoca.cz/joomlademo/phoca-maps-kml - the kml is automatically zoomed to see the marked area :idea:

Jan
If you find Phoca extensions useful, please support the project
myaso1488
Phoca Member
Phoca Member
Posts: 11
Joined: 29 Jul 2016, 13:53

Re: KML file zoom size

Post by myaso1488 »

YES! But, a don't wanna auto zoom to KML area.
That my map after load KML file http://shot.qip.ru/00Qtrh-5mIrA3NYm/
But i want like that http://shot.qip.ru/00Qtrh-6mIrA3NYn/
Like without KML - set center, set zoom in administrator panel and get great look.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: KML file zoom size

Post by Jan »

Hi, it is possible, that Google Maps API automatically wants to display all the areas so it automatically adds the low zoom to display all the area. Realyl hard to say, as I am not the developer of the Google Maps API but in some examples I have seen, the area set in KML was automatically zoomed so it is displayed as whole :idea:

Jan
If you find Phoca extensions useful, please support the project
myaso1488
Phoca Member
Phoca Member
Posts: 11
Joined: 29 Jul 2016, 13:53

Re: KML file zoom size

Post by myaso1488 »

Thats not solution? How i can use it in Phoca?
http://stackoverflow.com/questions/1148 ... map-center
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: KML file zoom size

Post by Jan »

Hi, where do you display the maps - in plugin or component?


administrator/components/com_phocamaps/helpersphocamapsmap.php line cca 1070

change
FROM:

Code: Select all

$js = ' var kmlLayer'.$this->_id.' = new google.maps.KmlLayer({ url: \''.$kmlFile.'\', suppressInfoWindows: true, preserveViewport: false, map: '.$this->_map.'});'."\n";
TO:

Code: Select all

$js = ' var kmlLayer'.$this->_id.' = new google.maps.KmlLayer({ url: \''.$kmlFile.'\', suppressInfoWindows: true, preserveViewport: true, map: '.$this->_map.'});'."\n";
Please let me know if this work for you, if yes, I will add it as parameter.

Thank you, Jan
If you find Phoca extensions useful, please support the project
Post Reply