The Government of Canada is making it easy to share the latest Economic Action Plan project geodata in your Google map. This document is a how-to guide on adding our geodata to your Google map.
The following tools are required to use EAP project geodata in other Google maps:
The ID and coordinates for one or more projects can be retrieved through the getProjects(langCd, initiativeId, projectId) function.
The following table describes the supported input parameters for the getProjects function.
| Parameter | Values | Mandatory | Default | Description |
|---|---|---|---|---|
langCd |
eng, fra |
No | eng |
Return the projects in the specified language. |
initiativeId |
<number> | No | Null | Return only the projects for the specified initiative. All projects will be returned if initiativeId and projectId are not specified. |
projectId |
<number> | No | Null | Return only the specified project. All projects will be returned if initiativeId and projectId are not specified. |
The following table describes the output values returned by the getProjects function.
| Name | Value | Description |
|---|---|---|
count |
<number> | Number of projects returned. |
projects.projectId |
<number> | Project ID for the current project. |
projects.longitude |
<number> | Longitude for the current project. |
projects.latitude |
<number> | Latitude for the current project. |
The following is the source code for the getProjects function:
function getProjects(langCd, initiativeId, projectId) {
var projectArray = $.ajax({
url: "/initiatives/includes/projectFinder.asp",
global: false,
type: "GET",
data: "langCd=" + langCd + "&pmode=1&projectId=" + projectId + "&initiativeId=" + initiativeId,
dataType: "html",
async: false
}).responseText;
eval(projectArray);
return data;
}
The details for a specific project can be retrieved through the getProject(langCd, projectId) function.
The following table describes the supported input parameters for the getProject function.
| Parameter | Values | Mandatory | Default | Description |
|---|---|---|---|---|
langCd |
eng, fra |
No | eng |
Return the results in the specified language. |
projectId |
<number> | Yes | n/a | Return the results for the specified project. |
The following table describes the output values returned by the getProject function.
| Name | Value | Description |
|---|---|---|
count |
<number> | Number of projects returned. |
projects.projectId |
<number> | Project ID for the current project. |
projects.longitude |
<number> | Longitude for the current project. |
projects.latitude |
<number> | Latitude for the current project. |
projects.name |
<string> | Name of the current project. |
projects.link |
<url> | Link to a Web site containing additional information about the current project. |
projects.image |
<url> | Link to the thumbnail image for the related initiative. |
projects.initiative |
<string> | Name of the related initiative. |
projects.value |
<string> | Range of the federal funding value for the current project. |
projects.federalFundingValue |
<number> | Estimated dollar value of the federal investment for the current project. |
projects.totalProjectValue |
<number> | Estimated total project value for the current project. |
projects.description |
<string> | Description of the current project. |
The following is the source code for the getProject function:
function getProject(langCd, projectId) {
var projectDetailArray = $.ajax({
url: "/initiatives/includes/projectFinder.asp",
global: false,
type: "GET",
data: "langCd=" + langCd + "&pmode=3&projectId=" + projectId,
dataType: "html",
async: false
}).responseText;
eval(projectDetailArray);
return data;
}
<script type="text/javascript">
<!--
var strLangCd = 'eng';
var arrData = getProjects(strLangCd, 67, 0);
var arrProjects = arrData.projects;
var intProjectCnt = arrProjects.length;
for (var intCnt = 0; intCnt < intProjectCnt; intCnt++) {
alert(arrProjects[intCnt].projectId + ": [" + arrProjects[intCnt].latitude + ", " + arrProjects[intCnt].longitude + "]");
arrData = getProject(strLangCd, arrProjects[intCnt].projectId);
var arrProjectDetails = arrData.projects;
// If we have a project display a few of the details. The fields we can choose from are:
// projectId, latitude, longitude, name, image, description, link, initiative and value.
if (arrProjectDetails.length > 0)
alert(arrProjectDetails[0].projectId + ": [name: " + arrProjectDetails[0].name + ", link: " + arrProjectDetails[0].link + ", description: " + arrProjectDetails[0].description + "]");
}
-->
</script>
For help and support with jQuery and the Google Maps API, please consult the following reference material: