Ignore:
Timestamp:
2020-01-20T21:59:53+01:00 (4 years ago)
Author:
simon04
Message:

see #14921 - WMS: support time={time} for Sentinel-2 imagery

Location:
trunk/src/org/openstreetmap/josm/data/imagery
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r15736 r15739  
    277277    /**
    278278      * creation date of the imagery (in the form YYYY-MM-DD;YYYY-MM-DD, where
    279       * DD and MM as well as a second date are optional)
     279      * DD and MM as well as a second date are optional).
     280      *
     281      * Also used as time filter for WMS time={time} parameter (such as Sentinel-2)
    280282      * @since 11570
    281283      */
  • trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java

    r15736 r15739  
    2222import org.openstreetmap.josm.gui.layer.WMSLayer;
    2323import org.openstreetmap.josm.tools.CheckParameterUtil;
     24import org.openstreetmap.josm.tools.Utils;
    2425
    2526/**
     
    3031 */
    3132public class TemplatedWMSTileSource extends AbstractWMSTileSource implements TemplatedTileSource {
    32     private final Map<String, String> headers = new ConcurrentHashMap<>();
    33     private final Set<String> serverProjections;
    3433    // CHECKSTYLE.OFF: SingleSpaceSeparator
    3534    private static final Pattern PATTERN_HEADER = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}");
     
    4342    private static final Pattern PATTERN_WIDTH  = Pattern.compile("\\{width\\}");
    4443    private static final Pattern PATTERN_HEIGHT = Pattern.compile("\\{height\\}");
     44    private static final Pattern PATTERN_TIME   = Pattern.compile("\\{time\\}"); // Sentinel-2
    4545    private static final Pattern PATTERN_PARAM  = Pattern.compile("\\{([^}]+)\\}");
    4646    // CHECKSTYLE.ON: SingleSpaceSeparator
     
    4949
    5050    private static final Pattern[] ALL_PATTERNS = {
    51         PATTERN_HEADER, PATTERN_PROJ, PATTERN_WKID, PATTERN_BBOX, PATTERN_W, PATTERN_S, PATTERN_E, PATTERN_N, PATTERN_WIDTH, PATTERN_HEIGHT
     51            PATTERN_HEADER, PATTERN_PROJ, PATTERN_WKID, PATTERN_BBOX,
     52            PATTERN_W, PATTERN_S, PATTERN_E, PATTERN_N,
     53            PATTERN_WIDTH, PATTERN_HEIGHT, PATTERN_TIME,
    5254    };
    5355
     56    private final Set<String> serverProjections;
     57    private final Map<String, String> headers = new ConcurrentHashMap<>();
     58    private final String date;
    5459    private final boolean switchLatLon;
     60
    5561    /**
    5662     * Creates a tile source based on imagery info
     
    6268        this.serverProjections = new TreeSet<>(info.getServerProjections());
    6369        this.headers.putAll(info.getCustomHttpHeaders());
     70        this.date = info.getDate();
    6471        handleTemplate();
    6572        initProjection();
     
    144151                replacement = String.valueOf(getTileSize());
    145152                break;
     153            case "time":
     154                replacement = Utils.encodeUrl(date);
     155                break;
    146156            default:
    147157                replacement = '{' + matcher.group(1) + '}';
Note: See TracChangeset for help on using the changeset viewer.