Index: trunk/scripts/SyncEditorLayerIndex.groovy
===================================================================
--- trunk/scripts/SyncEditorLayerIndex.groovy	(revision 11974)
+++ trunk/scripts/SyncEditorLayerIndex.groovy	(revision 11975)
@@ -197,6 +197,8 @@
         myprintln "*** Loaded ${eliEntries.size()} entries (ELI). ***"
     }
-    String cdata(def s) {
-        if(s =~ /[<>&]/)
+    String cdata(def s, boolean escape = false) {
+        if(escape) {
+            return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")
+        } else if(s =~ /[<>&]/)
             return "<![CDATA[$s]]>"
        return s
@@ -204,11 +206,20 @@
 
     String maininfo(def entry, String offset) {
-        String res = offset + "<type>${getType(entry)}</type>\n"
+        String t = getType(entry)
+        String res = offset + "<type>$t</type>\n"
         res += offset + "<url>${cdata(getUrl(entry))}</url>\n"
-        if(getType(entry) == "tms") {
+        if(t == "tms") {
             if(getMinZoom(entry) != null)
                 res += offset + "<min-zoom>${getMinZoom(entry)}</min-zoom>\n"
             if(getMaxZoom(entry) != null)
                 res += offset + "<max-zoom>${getMaxZoom(entry)}</max-zoom>\n"
+        } else if (t == "wms") {
+            def p = getProjections(entry)
+            if (p) {
+                res += offset + "<projections>\n"
+                for (def c : p)
+                    res += offset + "    <code>$c</code>\n"
+                res += offset + "</projections>\n"
+            }
         }
         return res
@@ -223,5 +234,5 @@
             def best = "eli-best".equals(getQuality(e))
             stream.write "    <entry"+(best ? " eli-best=\"true\"" : "" )+">\n"
-            stream.write "        <name>${getName(e)}</name>\n"
+            stream.write "        <name>${cdata(getName(e), true)}</name>\n"
             stream.write "        <id>${getId(e)}</id>\n"
             def t
@@ -230,7 +241,22 @@
             if((t = getCountryCode(e)))
                 stream.write "        <country-code>$t</country-code>\n"
+            stream.write maininfo(e, "        ")
+            if((t = getAttributionText(e)))
+                stream.write "        <attribution-text mandatory=\"true\">${cdata(t, true)}</attribution-text>\n"
+            if((t = getAttributionUrl(e)))
+                stream.write "        <attribution-url>${cdata(t)}</attribution-url>\n"
+            if((t = getTermsOfUseText(e)))
+                stream.write "        <terms-of-use-text>${cdata(t, true)}</terms-of-use-text>\n"
+            if((t = getTermsOfUseUrl(e)))
+                stream.write "        <terms-of-use-url>${cdata(t)}</terms-of-use-url>\n"
+            if((t = getPermissionReferenceUrl(e)))
+                stream.write "        <permission-ref>${cdata(t)}</permission-ref>\n"
+            if((getValidGeoreference(e)))
+                stream.write "        <valid-georeference>true</valid-georeference>\n"
             if((t = getIcon(e)))
                 stream.write "        <icon>${cdata(t)}</icon>\n"
-            stream.write maininfo(e, "        ")
+            for (def d : getDescriptions(e)) {
+                    stream.write "        <description lang=\"${d.getKey()}\">${d.getValue()}</description>\n"
+            }
             for (def m : getMirrors(e)) {
                     stream.write "        <mirror>\n"+maininfo(m, "            ")+"        </mirror>\n"
@@ -616,4 +642,13 @@
         return []
     }
+    static List<Object> getProjections(Object e) {
+        def r
+        if (e instanceof ImageryInfo) {
+            r = e.getServerProjections()
+        } else {
+            r = e.get("properties").get("available_projections")
+        }
+        return r ? r : []
+    }
     static List<Shape> getShapes(Object e) {
         if (e instanceof ImageryInfo) {
@@ -680,4 +715,39 @@
         return e.get("properties").getString("icon", null)
     }
+    static String getAttributionText(Object e) {
+        if (e instanceof ImageryInfo) return e.getAttributionText(0, null, null)
+        try {return e.get("properties").get("attribution").getString("text", null)} catch (NullPointerException ex) {return null}
+    }
+    static String getAttributionUrl(Object e) {
+        if (e instanceof ImageryInfo) return e.getAttributionLinkURL()
+        try {return e.get("properties").get("attribution").getString("url", null)} catch (NullPointerException ex) {return null}
+    }
+    static String getTermsOfUseText(Object e) {
+        if (e instanceof ImageryInfo) return e.getTermsOfUseText()
+        return null
+    }
+    static String getTermsOfUseUrl(Object e) {
+        if (e instanceof ImageryInfo) return e.getTermsOfUseURL()
+        return null
+    }
+    static String getPermissionReferenceUrl(Object e) {
+        if (e instanceof ImageryInfo) return e.getPermissionReferenceURL()
+        return e.get("properties").getString("license_url", null)
+    }
+    static Map<String,String> getDescriptions(Object e) {
+        Map<String,String> res = new HashMap<String, String>()
+        if (e instanceof ImageryInfo) {
+          String a = e.getDescription()
+          if (a) res.put("en", a)
+        } else {
+          String a = e.get("properties").getString("description", null)
+          if (a) res.put("en", a)
+        }
+        return res
+    }
+    static Boolean getValidGeoreference(Object e) {
+        if (e instanceof ImageryInfo) return e.isGeoreferenceValid()
+        return false
+    }
     String getDescription(Object o) {
         def url = getUrl(o)
Index: trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11974)
+++ trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11975)
@@ -175,5 +175,7 @@
     /** Text of a text attribution displayed when using the imagery */
     private String attributionText;
-    /** Link behing the text attribution displayed when using the imagery */
+    /** Link to a reference stating the permission for OSM usage */
+    private String permissionReferenceURL;
+    /** Link behind the text attribution displayed when using the imagery */
     private String attributionLinkURL;
     /** Image of a graphical attribution displayed when using the imagery */
@@ -222,4 +224,5 @@
         @pref String attribution_text;
         @pref String attribution_url;
+        @pref String permission_reference_url;
         @pref String logo_image;
         @pref String logo_url;
@@ -265,4 +268,5 @@
             attribution_text = i.attributionText;
             attribution_url = i.attributionLinkURL;
+            permission_reference_url = i.permissionReferenceURL;
             date = i.date;
             bestMarked = i.bestMarked;
@@ -429,4 +433,5 @@
         attributionText = e.attribution_text;
         attributionLinkURL = e.attribution_url;
+        permissionReferenceURL = e.permission_reference_url;
         attributionImage = e.logo_image;
         attributionImageURL = e.logo_url;
@@ -470,4 +475,5 @@
         this.attributionText = i.attributionText;
         this.attributionLinkURL = i.attributionLinkURL;
+        this.permissionReferenceURL = i.permissionReferenceURL;
         this.attributionImage = i.attributionImage;
         this.attributionImageURL = i.attributionImageURL;
@@ -520,4 +526,5 @@
                 Objects.equals(this.attributionText, other.attributionText) &&
                 Objects.equals(this.attributionLinkURL, other.attributionLinkURL) &&
+                Objects.equals(this.permissionReferenceURL, other.permissionReferenceURL) &&
                 Objects.equals(this.attributionImageURL, other.attributionImageURL) &&
                 Objects.equals(this.attributionImage, other.attributionImage) &&
@@ -633,4 +640,14 @@
     }
 
+    /**
+     * Return the permission reference URL.
+     * @param url The url.
+     * @see #setPermissionReferenceURL()
+     * @since 11975
+     */
+    public String getPermissionReferenceURL() {
+        return permissionReferenceURL;
+    }
+
     @Override
     public Image getAttributionImage() {
@@ -691,4 +708,14 @@
     public void setAttributionLinkURL(String url) {
         attributionLinkURL = url;
+    }
+
+    /**
+     * Sets the permission reference URL.
+     * @param url The url.
+     * @see #getPermissionReferenceURL()
+     * @since 11975
+     */
+    public void setPermissionReferenceURL(String url) {
+        permissionReferenceURL = url;
     }
 
Index: trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java	(revision 11974)
+++ trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java	(revision 11975)
@@ -197,4 +197,5 @@
                         "terms-of-use-text",
                         "terms-of-use-url",
+                        "permission-ref",
                         "country-code",
                         "icon",
@@ -437,4 +438,7 @@
                     entry.setTermsOfUseText(accumulator.toString());
                     break;
+                case "permission-ref":
+                    entry.setPermissionReferenceURL(accumulator.toString());
+                    break;
                 case "terms-of-use-url":
                     entry.setTermsOfUseURL(accumulator.toString());
