( ! ) Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'WPtouchPlugin::wptouch_parse_request' was given in C:\Domains\adamestrada.com\wwwroot\wp-includes\plugin.php on line 414
Call Stack
#TimeMemoryFunctionLocation
10.435961904{main}( )..\wp-404-handler.php:0
20.436967672include( 'C:\Domains\adamestrada.com\wwwroot\index.php' )..\wp-404-handler.php:7
30.437367960require( 'C:\Domains\adamestrada.com\wwwroot\wp-blog-header.php' )..\index.php:17
41.09962611632wp( )..\wp-blog-header.php:14
51.09962611912WP->main( )..\functions.php:1434
61.09962612016WP->parse_request( )..\classes.php:490
71.10762632112do_action_ref_array( )..\classes.php:293
81.10782633232call_user_func_array ( )..\plugin.php:414
C# and GMapEZ | Adam Estrada

GmapEZ

2010 February 6
by Adam Estrada

Using GMapEZ

I have been using GMapEZ for a few years now and it continues to impress me by how easy it is to use. The GMapEZ  script completely eliminates the need for any javascript programming which in my opinion is a really good thing. I have used it in the past to add pushpins that are returned form any number of data sources. I like classic ASP so I’ve returned data from an ASP RecordSet or now a days from a .NET DataReader. At any rate, you simply have to read data from the DB and then write out the HTML to represent the structure needed to put pushpins on your map. Here is a C# example of what I am talking about.

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
public partial class Pages_mapPanel : System.Web.UI.UserControl
{
    #region Page Props
 
    public String defaultGmapPage = "http://maps.google.com/maps";
    public String defaultPage = ConfigurationSettings.AppSettings["defaultPage"];
 
    #endregion
 
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string mapPlaceHolder = this.loadMapData();
            this.ctlPlaceHolder.Controls.Add(new LiteralControl(mapPlaceHolder)); 
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
 
    #region loadMapData()
    public String loadMapData()
    {
        try
        {
            OracleConnection conn = new OracleConnection();
            String mainConn = ConfigurationManager.ConnectionStrings["MainConnStr"].ConnectionString;
            conn.ConnectionString = mainConn;
            conn.Open();
            OracleCommand cmd = new OracleCommand();
            cmd.CommandType = CommandType.Text;
 
            String query = "SELECT * FROM MYTABLE ORDER BY DATEIN DESC";
            cmd.CommandText = query;
            cmd.Connection = conn;
 
            cmd.ExecuteReader();
            OracleDataReader dr = cmd.ExecuteReader();
            StringBuilder map = new StringBuilder();
            QueryString qs = new QueryString();
 
            while (dr.Read())
            {
                qs.Add("fid", "ms");
                qs.Add("id", dr["ID"].ToString());
 
                    map.Append("<a id=\"" + dr["ID"].ToString() + "\" href=\"" + defaultGmapPage + "?ll=" + dr["LATITUDE"].ToString() + "," + dr["LONGITUDE"].ToString() + "&amp;t=k&amp;hl=en\">GREEN MINI</a>");
                    map.Append("<div title=\"Event\"><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">");
                    map.Append("<strong>Name:</strong> " + dr["NAME"].ToString() + "<br />");
                    map.Append("<strong>Type:</strong> " + dr["TYPE"].ToString() + "<br />");
                    map.Append("<strong>Description:</strong> " + dr["DESC"].ToString() + "<br />");
                    map.Append("<a href=\"" + defaultPage + qs + "\">Go To Main Page...</a>");
                    map.Append("</font></div>");
                    map.Append("<div title=\"Dates\"><font size=\"1\" face=\"Arial, Helvetica, sans-serif\">");
                    map.Append("<strong>Date In:</strong> " + dr["DATEIN"].ToString() + "<br />");
                    map.Append("<strong>Date Out:</strong> " + dr["DATEOUT"].ToString() + "<br />");
                    map.Append("<a href=\"" + defaultPage + qs + "\">Go To Main Page...</a>");
                    map.Append("</font></div>");
                }
            }
 
            conn.Close();
            return map.ToString();
        }
        catch (Exception ex)
        {
            Zekiah.Logging.LoggingManager.WebApplication.Error("A Fatal Error has occured in the Map Control", ex);
            redirectToFailure();
            return null;
        }
    }
    #endregion
 
	#region Failure Notice 
    private void redirectToFailure()
    {
        QueryString qs = new QueryString();
        qs.Add("fid", "ERROR");
        Response.Redirect(defaultPage + qs, false);
    }    
    #endregion 
}

Please note that I am reading data from an Oracle Database and simply returning it as a properly formatted String in HTML format. Each pushpin also has two tabs which can hold extra data including another URL. For more information on what you can do with GMapEZ, check out the examples on the hosted site. You’ll also note that I used a class written by Bobby ReRosa called “QueryString”. What a freaking time saver this thing is! Thanks Bobby…I actually want to write more on how to use it in another blog post so look for that one too.

Bookmark and Share
No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS

Spam protection by WP Captcha-Free