0
votes

I'm creating a GeoJSON FeatureCollection through Oracle ORDS. The result is a GeoJSON that has some extra curcly braces, brackets and info.

When trying to create a Leaflet map with this data I get a parse-error. The brackets are most likely the issue because when I grab the yellow highlighted part and put it in a file I can load the data without any hickups.

Does anyone know how to parse only the yellow highlighted part or to remove the excess from the ORDS output? Orcle ORDS output

2

2 Answers

0
votes

More specifically, it's a data structure that contains some geoJson as a subset.

You don't provide the code you're using to parse the input, but instead of feeding the whole data structure to L.geoJSON (or however you're doing it), load the data into a variable and pass items[0].geojson instead.

0
votes
const api_url = "url";

async function getApi() {
  const response = await fetch(api_url);
  const data = await response.json();
 // console.log(data); //
  L.geoJson(data.items[0].geojson).addTo(map);
}
getApi();