Community
    • Login

    Is it possible to merge two lines in a KML file ?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 445 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Josef MoertlJ
      Josef Moertl
      last edited by

      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>LF

      or 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

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Josef Moertl
        last edited by

        @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 expression

        It’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…

        Josef MoertlJ 1 Reply Last reply Reply Quote 3
        • Josef MoertlJ
          Josef Moertl @Alan Kilborn
          last edited by

          @Alan-Kilborn

          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 !!!

          Alan KilbornA 1 Reply Last reply Reply Quote 1
          • Alan KilbornA
            Alan Kilborn @Josef Moertl
            last edited by

            @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.

            1 Reply Last reply Reply Quote 1
            • guy038G
              guy038
              last edited by

              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

              Josef MoertlJ 1 Reply Last reply Reply Quote 2
              • Josef MoertlJ
                Josef Moertl @guy038
                last edited by

                @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 … ;-)

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors