UrlSynchronization

Inherits ResourceSynchronization

Members

Name

Documentation

Type

Description

Optional

Identifier

This identifier will be part of the used folder structure and, can be used to manually find the downloaded folder in the synchronization folder

Identifier

An identifier string. May not contain ‘.’, spaces, newlines, or tabs

No

Url

The URL or urls from where the files are downloaded. If multiple URLs are provided, all files will be downloaded to the same directory and the filename parameter must not be specified simultaneously

String, or Table

Value of type ‘String’, or Value of type ‘Table’

No

Filename

Optional to provide filename to override the one which is otherwise automatically created from the url. If this value is specified, the url parameter only only contain exactly one URL

String

Value of type ‘String’

Yes

Override

Deprecated, use SecondsUntilResync instead

Boolean

Value of type ‘Boolean’

Yes

SecondsUntilResync

This variable determines the validity period of a file(s) in seconds before it needs to be re-downloaded. The default value keeps the file permanently cached, while a value of 0 forces the file to be downloaded on every startup. If the symbolic value math.huge is used, a file is never redownloaded after the first time.

Double

Greater or equal to: 0

Yes

UseHash

If this value is set to ‘true’ (the default), the hash of the URL is appended to the directory name to produce a unique directory under all circumstances. If this is not desired, the URLSynchronization use the bare directory name alone if this value is ‘false’. If this value is ‘false’, the identifier has to be specified

Boolean

Value of type ‘Boolean’

Yes

Asset Examples

 1local earth = asset.require("scene/solarsystem/planets/earth/earth")
 2
 3
 4
 5local data = asset.resource({
 6  Name = "GeoJSON Example Lines",
 7  Type = "UrlSynchronization",
 8  Identifier = "geojson_example_lines",
 9  Url = "http://liu-se.cdn.openspaceproject.com/files/examples/geojson/lines.geojson"
10})
11
12
13local ExampleLines = {
14  Identifier = "Lines-Example",
15  File = data .. "lines.geojson",
16  HeightOffset = 20000.0,
17  DefaultProperties = {
18    LineWidth = 2.0
19  },
20  Name = "Example Lines"
21}
22
23
24asset.onInitialize(function()
25  openspace.globebrowsing.addGeoJson(earth.Earth.Identifier, ExampleLines)
26end)
27
28asset.onDeinitialize(function()
29  openspace.globebrowsing.deleteGeoJson(earth.Earth.Identifier, ExampleLines)
30end)
31
32asset.export(ExampleLines)
33
34
35
36asset.meta = {
37  Name = "GeoJson Example - Lines",
38  Description = [[GeoJson example asset with lines]],
39  Author = "OpenSpace Team",
40  URL = "http://openspaceproject.com",
41  License = "MIT license"
42}