-
Notifications
You must be signed in to change notification settings - Fork 3
Region Map Implementations
Myeong Lee edited this page Jun 8, 2018
·
2 revisions
The menu item Findings by Region has mini-maps on the webpages. This documentation describes how they are implemented.
- For every individual region map, we have a separate PHP file (the code for each map) and .js files (GeoJSON data) stored in the
/js-customfolder. - The
dbconnect.phpfile is common to all the individual map: This file needs to be combined with the global credentials file. - The following are the files for individual map viz.
- EastAsiaMap.php
- EuropeMap.php
- LatinAmericaMap.php
- MidEastMap.php
- NorthAmericaMap.php
- SouthAsiaMap.php
- SubSaharanMap.php
- EastAsia.js
- EuropeCentralAsia.js
- LatinAmericaCarr.js
- MidEast.js
- NorthAmerica.js
- SouthAsia.js
- SubSaharanAfrica.js
dbconnect.php
- This file is used to get the data from the MySQL database.
-
$mapreggets the country region from the individual PHP files - The query is stored in the
$myqueryvariable which gets the count of organization and the name of a particular country for that particular region - The data is then passed to the PHP file using the $data variable.
- The code in all the PHP files is very much the same and can be combined into a single file in the future.
- It sets the
mapregvariable to the particular region and then calls the dbconnect.php file. - Next step is to set the base map layer using the
maplayervariable. - The map variable is used to set the zoom of the map and the boundaries.
-
Info.Addis used to add the Information on the top right of the map. -
Getcolorfunction is used to get the color of the country according to the number of organizations. -
Stylefunction is used to style the data. - The
highlightFeaturefunction is activated when the mouse hovers over a particular country. - The
resetHighlightis activated as soon as you hover away from the region -
OnEachFeatureis used to process the GeoJSON data and respond tomouseoverandmouseoutevents. -
Countcontains the total number of rows acquired from thedbconnect.phpfile. - Regions variable contains the geoJSON data for which we use the for loop to process and manipulate.
- We match the ios2 code from
$data.iso2obtained fromdbconnect.phpfile and the iso2 code from regions to change theregions.AREAproperty to the number of organizations for that particular country. - The
legend.onAddis used to add the legend on the bottom right of the map
-
Implementations
-
Deployment and Update