Is it possible to merge two lines in a KML file ?
-
Hey guys,
in Google Earth it is unfortunately not possible to change the size of the labeling of several placemarks at once. It is only possible for one placemark.
I´m wondering whether it is possible with Notepad ++.
The size of the label is saved in a KML file with the following code:
<LabelStyle>
<scale>0.9</scale>
</LabelStyle>All this three lines end with LF (Line Feed)
Is it possible to remove LF after <LabelStyle> to get <LabelStyle> and <scale>0.9</scale> into one line like this ?
<LabelStyle><scale>0.9</scale>
</LabelStyle>LFor even like this ?
<LabelStyle><scale>0.9</scale></LabelStyle>
You could then use Find and Replace to change the size of the label for many hundreds of placemarks.
Thanks for your help !!!
With kind regards
Josef -
@Josef-Moertl said in Is it possible to merge two lines in a KML file ?:
or even like this ?
<LabelStyle><scale>0.9</scale></LabelStyle>
Try:
Find:
(?-si:<LabelStyle>|(?!\A)\G)(?s-i:(?!</LabelStyle>).)*?\K(?-si:\R)
Replace: make sure this box is empty
Search mode: Regular expressionIt’s an application of a technique discussed HERE. It’s a bit of an advanced thing for your problem, but it works.
However, I’m concerned that you may not have stated your problem correctly–we shall see…
-
Unbelievable … I’m sitting here at my desk and shaking my head … I still can’t believe it … Alan you are a genius !!! … the formula looks soooo complicated … but … it worked exactly as I wanted it to
Alan thanks a lot !!!
This is something I will never forget
Thank you !!! -
@Josef-Moertl said in Is it possible to merge two lines in a KML file ?:
Alan you are a genius
Well. Ahem. Credit for the base formula goes to its author; see the link I provided.
-
Hello @josef-moertl, @alan-kilborn and All,
Of course, the @alan-kilborn solution works nice ! But, as you said :
You could then use Find and Replace to change the size of the label for many hundreds of placemarks.
I’m thinking about an second solution !
For example, from this INPUT text, part of your
KLM
file :... ... <LabelStyle> <scale>0.9</scale> </LabelStyle> ... ... ... <LabelStyle> <scale>37</scale> </LabelStyle> ... ... <LabelStyle> <scale>100</scale> </LabelStyle> ... ...
Using the regex S/R :
-
SEARCH
^(\h*<LabelStyle>\R\h*<scale>)\d+(?:\.\d+)?(</scale>\R\h*</LabelStyle>\R)
-
REPLACE
${1}3.7${2}
It would change the size of any label to the
3.7
value and you’ll get the OUTPUT text, below :... ... <LabelStyle> <scale>3.7</scale> </LabelStyle> ... ... ... <LabelStyle> <scale>3.7</scale> </LabelStyle> ... ... <LabelStyle> <scale>3.7</scale> </LabelStyle> ... ...
Thus, although I miss something obvious, no need to get each block of
3
lines in a single line !In addition, like the @alan-kilborn’s regex, it does not mind about the kind of
EOL
, which can be, either a Windows, Unix or Mac line-break !Just place, in the replacement part, your desired number between the two values
${1}
and${2}
. For instance :-
${1}100${2}
-
${1}0.05${2}
-
${1}0${2}
-
${1}12.3456{2}
Best Regards,
guy038
-
-
@guy038
… you guys are really incredible … for me this is another dimension !!! … wow … it worked great !!! … and I hope that your solutions will help many many others … I’m pretty sure about that, as I spent hours !!! trying to find a solution before, as this is not possible with Google Earth and there is no third party software solution yet …
Thank you so much … ;-)