As salamu alaykum wa Rahmat Allah wa Barakatuhu,
In sha Allah, may this e-mail find all of you strong in your deen, health, and wealth.
I have an idea about how to load information on the site, and I think it might have an impact on the structure of the database(s).
At the present time all the data on the site is stored in the same file that contains the html and javascript that produce the map and markers.
To date I had envisioned that the future of the project was a site that would call up all that information from a database. And that the database would improve the site in two ways (1) information management and (2) allow the site to load Iqamah data by comparing the current date to the Iqamah dates.
But, in sha Allah, some day there will be many, many masajid on the map. Eventually information management will mean that we want the site to load as easily and quickly as possible. Right now, with exactly 98 jamat, the file generating the map is 29 kb. How large a file would it be if we had 1,000 jamat? How long would a database request take that called for all 1,000? And imagine when, in sha Allah, we have achieved a database the size of Islamicfinder's? That's a LOT of jamat!
So, I have three ideas that may make the site more efficient over the long term:
(1) Only call up the data that goes in the "infowindow" when a marker is clicked. Currently when an infowindow is clicked, the contents were already present in the code. But to draw the marker, all that is necessary are the coordinates. If we also included the "masjid ID" number, then when the marker is clicked, the code that creates the infowindow could call another HTML/PHP file and pass it the masjid ID. That second file would get the data from the database for that masjid ID (for the appropriate iqamah date), and then generate the contents of the info window. Very little data would be requested, and the file sizes would be very small compared to the current site -- no matter how many jamat were in the database.
Whether the current proposed structure of two databases (one static data and one iqamah data) is sufficient or whether three databases are better (splitting the static data into one with coordinates and one with other data, and all three indexed by Jamat ID) -- that I leave to the experts.
(2) Do not display jamat when visitors first come to the site. Maybe the only image people would see is the night-map that currently displays. Or maybe show them the Harram on the satellite images. Then, when a person enters a street address, call up and display all the data points for the jamat within a large polygon centered on that street address. There are lots of other non-dawah sites that use this technique.
Basically we would tell the program to return data points 200 miles (roughly 3 degrees) north and south, as well as 200 miles east and west (or some other number) and return a map that displayed all that data. If the person entered a new street address, we could either call up a new map, or limit the person to the map that was generated. The larger the polygon, and the one suggested here is over 40,000 square miles or more than 400 times the size of Washington, DC, the more data points.
(3) A variation on both ideas above is that all the data points are called up by the software, but only those markers are created that fit within the display area plus the surrounding tiles. This method is also already in use by other sites. When the user enters a new address, or when he drags the map a significant distance -- enough to change which map tiles are displayed or adjoining, then the site would automatically add and remove displayed markers -- utilizing data called up when the site first loaded.
As salamu alaykum wa Rahmat Allah wa Barakatuhu,
Tariq Ahmed