So what I would like to do is store the data in a separate file and retrieve just the data I need when the element is selected. I am a beginner level, so I don’t know if I am day dreaming.
Right now what I did was create an array with all airports, another with all waypoints and another with the aircrafts. A function retrieves the data from the array and returns the object. But that seems like a waste of memory.
Another idea I had was to mae a function with a switch statement, using the ids (airport/waypoint code for example) and returning the object selected. I did this for the magnetic deviation, using the coordinates.
I would like to make something that I can update later in the future, but with a simple structure, if at all possible. SQL sure pops in mind, but I am thinking of something more local. LocalStorage also appears to be an idea, but it would have to be initialized everytime the browser loaded, and still would be a waste of memory
This question is kind of relative, and some people could even view it as opinion-based. However, I think a concrete answer can be found accounting for some details.
Storing it in the application (arrays/objects)
Yes, that’s what you’re doing now, and that’s what you view like a waste of memory, I know. However, depending on your situation, you shouldn’t care too much about that.
Anyway, I’d recommend you to keep your data this way when it is not too large and is unlikely to change. Probably this is not the best alternative for you, since you said you pretend to update the data in the future. It’s not only about memory, but also about maintainability.
Local web storage
If the solution above is not suitable for you, probably this also isn’t. Why? It’s simple. In the process of storing data in
localStorage, you’ll need to have that data in your code, in the form of an array or object. In the end, you’ll have the data in your application AND in the local web storage. It doesn’t make much sense, don’t you agree?
localStorage should be used for storing data which is relative to the user and which will not be accessible for you after the page is left, unless you save it. This kind of storage would be not be a good choice for storing data that will be accessible for you at any condition.
Using a JSON file
This could be a good solution if your data is not likely to change constantly. And it also would meet your expectations, since you could request data from it only when it’s needed. You should take your own situation into account, but, from what I could understand from what you said, that is, you have data which is going to change sometimes and it’s somewhat large, using a JSON file would be a good if you don’t want to use a database.
Finally, there are several advantages, even for static (but somewhat large) data, of using a database. You could opt, for example, for SQLite, that’s an embedded database. However, that is a topic for another question.
For now, since your data will change sometimes and is potentially lengthy, using a JSON file looks like the more suitable option within the “no-database” limits.