unable to load spatial data in terriaMap in android localhost

163 views Asked by At

We are working on a project where we have our custom JSON files to load offline(from the App itself) as well as loading data from remote sites too in TerriaMap. So for that, we are creating localhost inside the android system with a specified port currently 8080. Most of the samples are loading correctly offline, 3D data don't show but app zoom to the right place. Some of the JSON files are loading data from remote sites.
When I try dataset based on the samples json file here. This file shows data correctly without any error on the localhost in computer and fetches data from remote sites But in the android system it shows a syntax error:

SyntaxError: Unexpected token j in JSON at position 0

On investigating android console I found that _1d/ is being added to the URL as a prefix to the response. So, the URL becomes _1d/URL. Here is the detail

E/====: _1d/https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer
E/Ion: exception java.lang.Exception: Unknown uri scheme
result
I/System.out: close [socket][::/:::8080]
I/ServerRunnable: Handling request {0} {1}
E/====: _1d/https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/layers
E/Ion: exception java.lang.Exception: Unknown uri scheme
result
I/System.out: close [socket][::/:::8080]
I/art: Enter while loop.
I/ServerRunnable: Handling request {0} {1}
E/====: _1d/https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/legend
E/Ion: exception java.lang.Exception: Unknown uri scheme
result
I/System.out: close [socket][::/:::8080]
I/chromium: [INFO:CONSOLE(408)] "SyntaxError: Unexpected token j in JSON at position 0", source: http://localhost:8080/build/7.TerriaMap.js (408)
I/chromium: [INFO:CONSOLE(0)] "Access to XMLHttpRequest at 'https://assets.cesium.com/1/layer.json' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains the invalid value 'localhost'.", source: http://localhost:8080/#tmg_catalog_custom (0)
I/chromium: [INFO:CONSOLE(56)] "An error occurred in "T": An error occurred while accessing https://assets.cesium.com/1/layer.json.", source: http://localhost:8080/build/7.TerriaMap.js (56)
I/ServletContainerImpl: Running outdated servlets check - no servlets registered.
I/ServletContainerImpl: Running outdated servlets check.

How can I make it work in android? Any help/guideline is welcome.

0

There are 0 answers