Skip to content

Commit

Permalink
chore(web): czml and kml local not working (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyshx authored Nov 1, 2023
1 parent 9581784 commit 12eddc8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions web/src/beta/features/Editor/DataSourceManager/Common/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ const Asset: React.FC<DataProps> = ({ sceneId, onSubmit, onClose }) => {
let parsedValue = null;

if (sourceType === "value" && value !== "") {
try {
parsedValue = JSON.parse(value);
} catch (error) {
parsedValue = value;
if (fileFormat === "GeoJSON") {
try {
parsedValue = JSON.parse(value);
} catch (error) {
parsedValue = value;
}
} else {
parsedValue = "data:text/plain;charset=UTF-8," + encodeURIComponent(value);
}
}

Expand All @@ -70,7 +74,12 @@ const Asset: React.FC<DataProps> = ({ sceneId, onSubmit, onClose }) => {
visible: true,
config: {
data: {
url: (sourceType === "url" || sourceType === "local") && value !== "" ? value : undefined,
url:
(sourceType === "url" || sourceType === "local") && value !== ""
? value
: fileFormat === "CZML" || fileFormat === "KML"
? parsedValue
: undefined,
type: fileFormat.toLowerCase() as DataType,
value: parsedValue,
},
Expand Down

0 comments on commit 12eddc8

Please sign in to comment.