Skip to content
  • Sébastien Guimmara's avatar
    fix(VectorSource): remove ambiguities in data parameter · 650a6bf7
    Sébastien Guimmara authored
    BREAKING CHANGE: The `data` parameter of `VectorSource` has changed to
    remove ambiguities between URLs and text data, and allow relative URLs.
    Please refer to the documentation for more details.
    
    For URL based sources:
    
    ```js
    // Before
    const source = new VectorSource({
        data: 'http://example.com/data.geojson',
        format: new GeoJSON(),
    });
    
    // Now
    const source = new VectorSource({
        data: {
            url: 'http://example.com/data.geojson',
            format: new GeoJSON(),
        },
    });
    ```
    
    For content based sources (e.g a GeoJSON document):
    
    ```js
    const geojson = JSON.parse(...);
    
    // Before
    const source = new VectorSource({
        data: geojson,
        format: new GeoJSON(),
    });
    
    // Now
    const source = new VectorSource({
        data: {
            content: geojson,
            format: new GeoJSON(),
        },
    });
    ```
    650a6bf7