Features

Projects Map
Watch Ads
Apprenticeship Grants
5th Report to Canadians

How to add EAP project geodata to your Google map


 

1.0 Overview

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.

2.0 Minimum Requirements

The following tools are required to use EAP project geodata in other Google maps:

3.0 How to Retrieve the ID and Coordinates for One or More Projects

The ID and coordinates for one or more projects can be retrieved through the getProjects(langCd, initiativeId, projectId) function.

3.1 Input parameters

The following table describes the supported input parameters for the getProjects function.

ParameterValuesMandatoryDefaultDescription
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.

3.2 Output values

The following table describes the output values returned by the getProjects function.

NameValueDescription
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.

3.3 Sample source code

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;
}

4.0 How to Retrieve the Details for a Specific Project

The details for a specific project can be retrieved through the getProject(langCd, projectId) function.

4.1 Input parameters

The following table describes the supported input parameters for the getProject function.

ParameterValuesMandatoryDefaultDescription
langCd eng, fra No eng Return the results in the specified language.
projectId <number> Yes n/a Return the results for the specified project.

4.2 Output values

The following table describes the output values returned by the getProject function.

NameValueDescription
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.

4.3 Sample source code

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;
}

5.0 Sample Usage

<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>

6.0 Help and Support

For help and support with jQuery and the Google Maps API, please consult the following reference material:

Share this page

 

Site Map

Government of Canada
Symbol of the Government of Canada