I want to make a feature in a react.js web application where I can export/download shapefiles from the dashboard. I have implemented shp-write which takes a GeoJSON input. It is working fine with textual data. I would like to add 3 attributes which should contain an image in the shapefile. I have saved the required Image in my local storage. There is no JavaScript NPM module to do so
My implementation
var shpwrite = require('shp-write');
var options = {
folder: 'myshapes',
types: {
point: 'mypoints',
polygon: 'mypolygons',
line: 'mylines'
}
}
// a GeoJSON input for features
shpwrite.download({
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [0, 0]
},
properties: {
name: 'Foo',
image: 'C:\Users\DELL1\Downloads\Survey.png'
}
},
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [0, 10]
},
properties: {
name: 'Bar',
image: 'C:\Users\DELL1\Downloads\Survey.png'
}
}
]
}, options);
The Current output has image path as a text type field. It doesn't contain image.
My Expected output should contain the image itself.
What approach can I use in JavaScript to achieve this result.