yarl / vicuna

Tool for uploading files to Wikimedia Commons and other Wikimedia projects
http://yarl.github.io/vicuna/
43 stars 23 forks source link

Reading out heading out of {{Location}}-template #139

Open fundriver opened 3 years ago

fundriver commented 3 years ago

Hello,

well this is a feature request, already including a solution how to fix this in the code. At least basicly tested and working for my own purposes (so I can tag my pictures including heading in the newest branch).

I edited the FCoord.java (Line 347) as following to read out the heading out of a turned in Location-Template

    //{{Coord|52|14|5.15|N|21|7|51.91|E|region:PL}}
    else if (input.matches(".*[Kk]oordynaty|.*") || input.matches(".*[Cc]oord|.*") || input.matches(".*[Ll]ocation|.*")) {
        String[] s = input.split("\\|");
        if (s.length > 8) {    //długi
            String lat[] = { s[1], s[2], s[3] };
            String lon[] = { s[5], s[6], s[7] };

          if (s.length > 9 && s[9] != null && s[9].contains("heading:")){
                  String additions[] = input.split("_");
                  String heading = "";

              for (String addition : additions) {
                  if (addition.contains("heading:")) {
                      String additionsplit[] = addition.split(":");
                      heading = additionsplit[1];
                  }
              }
              coor = new Coord(lat, s[4], lon, s[8], heading);
          }
          else {
              coor = new Coord(lat, s[4], lon, s[8]);
          }
        }
    }

Well, however, but this is also the case with pre-tagged pictures as far i am aware off, the heading doesn't get saved into the session.xml and you will loose at this point in time. Maybe someone wants to think this further and also include it into the save-state.

michal-josef-spacek commented 3 years ago

@fundriver Saving of heading to session file: https://github.com/yarl/vicuna/pull/141 Tested on file with "GPS Img Direction" exif