0

I have a KML file that has multiple coordinates. I want to trim the coordinates to see if it will reduce the size.

CHANGES The LatLng is different and not in a consistent format. Below is a sample of the LatLng that I have within my file. My apologies for not using a more accurate capture I didn't realize that it would affect the RegEx.

20.0649556884364,42.546758117893,0
-6.665609089909049,61.4394550582227,0
142.843146200241,54.2804088338613,0

This goes on for awhile as it is a multigeometry polygon. I would like to reduce the LatLng to 20.1234,20.1234

How do I remove the last 9 digits leaving only 4 after the period?

2
  • stackoverflow.com/questions/20286068/… does that help a bit? you just need to tailor the regex to your need and fiddle with the return variables \1 and such May 21, 2015 at 6:34
  • I'm working with this one but even the updated one does not work for notepad++ 6.3
    – JA1
    May 21, 2015 at 6:39

1 Answer 1

3

Find what:

(\.\d{4})\d+

Replace with:

$1

DEMO

7
  • Sorry it's still not working I do the following 'ctrl+H' selected
    – JA1
    May 21, 2015 at 6:45
  • did you enable the regular expression radio button? May 21, 2015 at 6:46
  • I selected that and also .matches newline then in the find I typed the code you provided and the replace with a $1.
    – JA1
    May 21, 2015 at 6:46
  • Sorry this works, I failed to mention that the code is a bit different than my example. I made the edit to my original post to reflect the accurate LatLng
    – JA1
    May 21, 2015 at 6:50
  • In Notepad++, you can use both \1 and $1 in the replacement string. May 21, 2015 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.