Howdy,
I am banging my head against the wall trying to supply my custom data feed with a picture marker symbol. Nothing I have tried in the model.js file works. I was advised not to go messing with boilerplate stuff like the renderer.js file under /framework/featureserver/src/helpers. Has anyone else done this? If so could you help me understand how to accomplish this task?
Hello,
Can you let me know which version of ArcGIS Enterprise SDK you are working with? If you wouldn't mind, could you paste a little sample of marker rendering code you are trying implement? Thanks.
We are using 11.4 of the sdk.
@John_Hash wrote:Hello,
Can you let me know which version of ArcGIS Enterprise SDK you are working with? If you wouldn't mind, could you paste a little sample of marker rendering code you are trying implement? Thanks.
let drones;
try {
drones = JSON.parse(body);
} catch (parseError) {
console.error('Failed to parse JSON:', parseError);
self.error = parseError;
return;
}
let drawingInfo = {
renderer: {
symbol: {
outline: {
color: [255, 230, 1],
width: 200,
style: "esriSLSSolid",
type: "esriSLS"
}
}
}
}
const geojson = {
type: 'FeatureCollection',
metadata: { idField: "id", name: 'FOOBARDrones', type: 'FeatureCollection', drawingInfo, maxRecordCount: 1000 },
features: []
};
if (Array.isArray(drones) && drones.length === 0) {
geojson.features.push({
type: 'Feature',
geometry: { type: 'Point', coordinates: [-112.1, 33.5] },
properties: {
id: 314,
name: 'NO DRONE',
model: 'CEPSGIS',
camera: 'IPHONE CAMERA',
camera_id: 11122233,
speed: 45,
heading: -270,
callSign: 'FOOBAR',
altitudeAgl: 0,
altitudeMsl: 0,
video_url: 'https://www.youtube.com/watch?v=wZqeaUZ_2NM'
}
});
} else {
for (const drone of drones) {
if (drone.latitude && drone.longitude) {
geojson.features.push({
type: 'Feature',
geometry: { type: 'Point', coordinates: [drone.longitude, drone.latitude] },
properties: {
id: drone.id,
name: drone.missionName,
model: drone.model,
camera: drone.sensors[0]['name'],
camera_id: drone.sensors[0]['id'],
speed: drone.speed,
heading: drone.heading,
callSign: drone.callSign,
altitudeAgl: drone.altitudeAgl,
altitudeMsl: drone.altitudeMsl,
video_url: drone.sensors[0]['video_url']
}
});
}
}
}
self.cachedGeojson = geojson;
self.error = null;
});
}
fetchData(); // run immediately
setInterval(fetchData, 15000); // rerun every 15 seconds
};
Model.prototype.getData = function (req, callback) {
if (this.error) {
callback(this.error);
} else {
callback(null, this.cachedGeojson || { type: "FeatureCollection",drawingInfo:drawingInfo, features: [] });
}
};
module.exports = Model;
On line 25 of your code, the metadata property you need to use is `renderer`. I would try removing the top-level "renderer" key from your "drawingInfo" object.
let drawingInfo = {
symbol: {
outline: {
color: [255, 230, 1],
width: 200,
style: "esriSLSSolid",
type: "esriSLS"
}
}
}
On line 25:
metadata: { idField: "id", name: 'FOOBARDrones', type: 'FeatureCollection', renderer: drawingInfo, maxRecordCount: 1000 },
Hopefully that will fix it. Please let me know the outcome.