I've recently started learning javascript and leaflet, and I'm in need of some advice.
My objective is:
- To send a picture from my phone to my server along with GPS exif data.
- To store this information in a file: JSON or database?
- To create a marker on leaflet that displays the photo and the name of the picture.
So far, I have successfully added a picture manually to a JSON file and then displayed it as a marker on a map.
JSON
var map = {
"type":"FeatureCollection",
"features":
[
{
"type":"Feature",
"properties":{
"name": "Coors Field",
"amenity": "Baseball Stadium",
"popupContent": "This is where the Rockies play!",
"imageAttached": "<a href='../img/picture.jpg' target='_blank'><img src='../img/avatar.png'/></a>"
},
"geometry":
{
"type":"Point",
"coordinates":[-6.646728515625,53.48804553605622]
}
},
{
"type": "Feature",
"properties": {
"popupContent": "Test"
},
"geometry": {
"type": "Point",
"coordinates": [-8.580322265624998, 53.44226352500856]
}
}
]
};
Javascript
L.geoJSON(map,{
}).bindPopup(function(layer){
var popUp = layer.feature.properties.popupContent;
var image = layer.feature.properties.imageAttached;
var pop = popUp + image;
return pop;
}).addTo(mymap);
It's working well so far, but I have some questions about the next steps:
- Is it a good practice to store JSON data in a variable like I did (var map = my data)? I came across this method in this tutorial.
- Can JavaScript extract exif info from files and dynamically retrieve information from new files in a folder? Or would it be better to use another language like Python?
- Would it be more efficient to store all future information in a JSON file or a database? If a database is preferred, which one would be the most suitable?
I appreciate any advice you can offer =)
Apologies for the lengthy post, here are some potatoes (unfortunately, I need 10 reputations to post images, so here are some minimalist potatoes): OOoO.