Using Data URL Method |
In this section we will see how to render a map using Data URL method - where the XML data is created in a file other than what we use to generate the map. The page that contains the code to render the map is referred to as Map Container Page and the other one which creates the XML data is called Data Provider Page. Let's look at the codes used in Map Container Page and Data Provider Page one by one. |
Before proceeding further, we recommend to go through the documentation How FusionMaps XT works? for a better insight. |
All code discussed here is present in Download Package > Code > VB_NET > BasicExample folder. |
Map Container Page |
Map Container Page contains the following code. You can view this code in BasicMapsArrayURL.aspx file. |
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="BasicArrayURL.aspx.vb" Inherits="BasicArrayExample_DataURL" %> <html> |
In the above code, we first include FusionCharts.js file to enable us embed the map using JavaScript. The code behind script generates the map in the literal control WorldPopulationMap. |
Let us see how code behind script in BasicMapsArrayURL.aspx.vb builds the map XML and renders the map: |
Imports InfoSoftGlobal 'FusionCharts.dll in bin folder Partial Class BasicArrayExample_DataURL '''<summary>This Function will Help to Generate US Map.</summary> 'Create the Map with data contained in DataURL 'embed the map rendered as HTML into Literal - WorldPopulationMap |
Steps involved in this code: |
|
Now, let us see the code in Data Provider Page WorldPopulationData.aspx |
Data Provider Page |
<%@ Page Language="VB" %> 'Declare array entity to store world population ' Now, we need to convert this data into combination XML. ' Initialize <map> element ' close data element </script> |
(Here we have used the same code for XML creation that we used in the Data String example.) |
The Steps involved in this code |
|
Here is the snap of the map: |