Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
DanM
Contributor II
Contributor II

Use RestAPI to provide GeoJson data (QlikSense Cloud)

I am reading GeoJson data from Weather.gov

I am manually saving the results from the API to a geoJson file and uploading.

 

Load * Extension
GeoOperations.ScriptEval('
Load()
DATASOURCE data GEOFILE url="lib://POC:DataFiles/WeatherAlerts.geojson"');

 

If I try to put my rest connection into the load command it says that it only accepts GeoJson file extensions. 

Is there a way to pull the GeoJson from an API? If not can I use an automation to save the file to Qlik Storage?

 

Thanks!

 

 

Labels (3)
1 Solution

Accepted Solutions
Patric_Nordstrom
Employee
Employee

GeoJSON is easiest to load using GeoOperations. The data doesn't have to geosjon ending.

Example:

weather:
Load * Extension GeoOperations.ScriptEval('
load() DATASOURCE weather GEOFILE type="geojson",
url="https://api.weather.gov/points/39.7456,-97.0892"');

 More GeoOperations examples: https://community.qlik.com/t5/Qlik-Sense-Documents/GeoOperations-Examples-Qlik-GeoAnalytics/ta-p/175...

View solution in original post

6 Replies
110
Contributor III
Contributor III

Stupid question , but in the headers, are you specifying type?  I.E. CSV / JSON / GeoJSON  etc. ? 
From the site  - are you requesting GEOJSON?

https://www.weather.gov/documentation/services-web-api


Formats

Endpoints typically have a GeoJSON default format, given the inclusion of geometry data. See the Specification tab for details on each endpoint. Below are common formats available by the API.

  • GeoJSON: application/geo+json
DanM
Contributor II
Contributor II
Author

Hello-

 

Yes it is GEOJson,  I can save the file off, and import it manually like in the example I have, but I cannot do it with a rest connector, and since the url doesn't end in .geojson it throws the error I described.

110
Contributor III
Contributor III

Sorry to hear  - sound like an oversight in the rest connector / geoJSON handling.  When I look for similar topics I find many people asking the same question but no resolution.

I'd maybe suggest reporting as a bug as it's something you'd expect to just work out the box.  You definitely shouldn't need to download externally, then re-import.  Defeats the purpose of having a rest connector!

DanM
Contributor II
Contributor II
Author

How do you open a bug? is that putting in a support case?

Patric_Nordstrom
Employee
Employee

GeoJSON is easiest to load using GeoOperations. The data doesn't have to geosjon ending.

Example:

weather:
Load * Extension GeoOperations.ScriptEval('
load() DATASOURCE weather GEOFILE type="geojson",
url="https://api.weather.gov/points/39.7456,-97.0892"');

 More GeoOperations examples: https://community.qlik.com/t5/Qlik-Sense-Documents/GeoOperations-Examples-Qlik-GeoAnalytics/ta-p/175...

DanM
Contributor II
Contributor II
Author

Thank you,

When I use it as a rest connector I had to put a User Agent in for the header, and I thought I would have to do something similar here. Thanks for the help.