[SOLVED] Kml convert-how to style rollover in kml

  • Chabi01
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
8 years 1 month ago - 8 years 1 month ago #10200 by Chabi01
Hi !

I'm here today for a new question :)

In a map, i have a kml file.
On Google Earth, i change the file to get a rollover effect on each polygon (working ok).

Now, if i import the kml file in ZhGoogleMap, i don't have the rollover effect anymore.
Ok.
I try this : in a text editor, i open the kml file to try to create paths with the coordinates by pasting the values.
Mmmm...when i do this, no more map at all.
I try to search why and it seems to be a difference between zhgooglemap and the kml file for the coordinates : in the kml file, i have something like this :
5.247852,45.948694,0 5.250479,45.94199999999999,0 5.25393,45.936416,0 5.250012,45.932092,0 5.263268,45.928917,0 5.269832,45.933186
but in Zhgooglemap, the values seems to be interverted
5.247852,45.948694
seems to become
45.948694,5.247852
Am i right ?

do you know how i could import the coordinates generated in the kml file to transform them in single path to get benefits of ZhGooglemap features for paths ?

Thanks :)
Xavier
Last edit: 8 years 1 month ago by Chabi01.

Please Log in or Create an account to join the conversation.

  • Chabi01
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
8 years 1 month ago #10201 by Chabi01
Replied by Chabi01 on topic Kml convert or how to style rollover in kml
So, is this possible ? To copy paste coordinates generated in a kml files to create paths ?
Thanks :)

Please Log in or Create an account to join the conversation.

  • Chabi01
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
8 years 1 month ago #10203 by Chabi01
Replied by Chabi01 on topic Kml convert or how to style rollover in kml
Ok, i saw that is not possible as coding is different.
In a kml file, you have something like this :
5.247852,45.948694,0 5.250479,45.94199999999999,0 5.25393,45.936416,0 5.250012,45.932092,0 5.263268,45.928917,0 5.269832,45.933186,0 5.281496,45.94429399999999,0 5.284316,45.943719,0 5.287275,45.94842100000001,0 5.292569,45.949301,0 5.296876,45.947698,0 5.30193,45.947695,0 5.305275,45.94978900000001,0 5.310326,45.94805000000001,0 5.309256,45.942375,0 5.311869,45.93485500000001,0 5.31663,45.934974,0 5.317879,45.93231899999999,0 5.3156,45.928622,0 5.322747,45.922551,0 5.331854,45.924598,0 5.332367,45.921491,0 5.34307,45.92279,0

The same thing in ZhGoogleMap is like this
45.948694,5.247852;45.94199999999999,5.250479;45.936416,5.25393;45.932092,5.250012;45.928917,5.263268;45.933186,5.269832;45.94429399999999,5.281496;45.943719,5.284316;45.94842100000001,5.287275;45.949301,5.292569;45.947698,5.296876;45.947695,5.30193;45.94978900000001,5.305275;45.94805000000001,5.310326;45.942375,5.309256;45.93485500000001,5.311869;45.934974,5.31663;45.93231899999999,5.317879;45.928622,5.3156;45.922551,5.322747;45.924598,5.331854;45.921491,5.332367;45.92279,5.34307;45.921521,5.351634;45.919492,5.359126

- values are permuted
- separator in kml are white space and are ";" in ZHgooglemap.

So, i did a little script to "translate from the kml.
If this can help, here the code :
<?php
$monfichier = fopen('zonekml.txt', 'r+');
$contenu = fgets($monfichier);

$trait = explode(",",$contenu);
//i put the value in a text file as this is only for me and one time. Best should be to have a field to fill the values.

//Now reorganise the value to have something working
for ($i=0;$i<count($trait)-2;$i+=2) {

echo $trait[$i+1];
echo ',';

if (substr($trait[$i], 0, 1)=='0') {
echo substr($trait[$i], 2, strlen($trait[$i])-2);
} else {
echo $trait[$i];
}
if ($i<(count($trait)-3)) {echo ';';}
}
//closing the file
fclose($monfichier);
?>

If that can be usefull for anybody :)
Xavier

Please Log in or Create an account to join the conversation.

  • Chabi01
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
8 years 1 month ago #10204 by Chabi01
Replied by Chabi01 on topic Kml convert or how to style rollover in kml
Ok, now, i have an additionnal question : for the paths, you can have the line in a different color on hover, but i can't find where to highlight all the polygon... Is this possible with the path in ZhGoogleMap as with kml files ?

Thanks !
Xavier

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #10205 by Dima
Hi

Sorry for delay.
As for first question. You can try to export (convert) to other format, for example KMZ. My extension doesn't parse KML for display it, I just use google's call to show KML file.
As for highlight KML layer - no, you can't do it. You can manage it (show/hide) by group list, but you can't change any property (for example, color) on the fly

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.

  • Chabi01
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
8 years 1 month ago #10208 by Chabi01
Replied by Chabi01 on topic Kml convert or how to style rollover in kml
Hi Dima,

Ok, as i need the hover color on paths, i change the display_map data on lines 8687 and 8693 from "StrokeColor" to "fillColor" and this works fine.
I don't have time to encode this for me right now directly (with a simple additionnal "hover color" field) but i have what i need to render.
I will post the map when the works will be hover :)
Thanks !
Xavier

Please Log in or Create an account to join the conversation.

Time to create page: 0.075 seconds

Donate


Go to top