Hi!
I am building a simple app with the ESRI javascript API. It contains two feature layers from an ESRI REST API, and I also need to get GPX-data from another API. I have managed to get and convert the GPX into geojson, and now I want to create a feature layer in my code to display the geojson data on the same map.
The question is how?
Here are code snippets:
Simple featureLayer:
var featureLayerEnkeltminner = new FeatureLayer("http://askeladden_wms.ra.no/arcgis/rest/services/WMS/RA_Askeladden/MapServer/1", {
infoTemplate: new InfoTemplate("${Navn}", "${*}"),
outFields: ["Navn", "KulturminneID", "KategoriID", "VernetypeID", "KOMM"]
});
Get and convert GPX-data:
var api = new KR.API();
var tur = {
api: 'utno2,
id: '2.11234',
type: 'gpx'
};
api.getData(tur, function (res) {
console.log(res);
The code above uses other javascript libraries than ESRI, but that should not be a problem. The console logs the object like it should:
Objectfeatures:
Array[1]0:
Objectgeometry:
Objectcoordinates:
Array[2057]
type: "LineString"
__proto__:
Objectproperties:
Objectname: "Flyktningeruta"
[...]
So the thing is that I need to use something like featureCollection to create a featureLayer, but how do I get the methods to use object I have created?
All help is greatly appreciated!
Chris