1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Programmatically retrieve geomapping data

Programmatically retrieve geomapping data

5 posts, 0 answered
  1. LBrinley
    LBrinley avatar
    59 posts
    Registered:
    29 Dec 2005
    25 Mar 2010
    Link to this post
    I'm using Geomapping data within the Events module.  Can I retrieve the geomapping data programmatically?  I've tried invoking a IPostBackEventHandler.RaisePostbackEvent on the (casted) IButtonControl that the GeomappingEditor control exposes (LnkAcquireGeomappingData) to no avail.  I've also tried to programmatically invoke the javascript functions called by the LnkAcquireGeomappingData LinkButton without success.  Please point me in the right direction.  I've run out of ideas.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    25 Mar 2010
    Link to this post
    Hello iVillageIdiot,

    What data you are trying to retrieve?

    In the EventsView  control the geomapping values - such as service name, geo longitude and geo latitude are parsed in a provate class and you cannot acces it , We also use a lot of js code that is embedded into the Telerik.Events.dll.

    GeomappingEditor is a custom control. It is used mainly in EventsItemEdit and EventsItemNew templates of events module. Here is a link to all GeomappingEditor members. You can access the GeomappingEditor controls if you create a cusom control and override InitializeControls method from where you will have access the the container.

    You can easily retrive the configuration settings

    var GoogleMapsAPIKey =  Telerik.Events.Configuration.ConfigHelper.Handler.GoogleMapsAPIKey;
              var  GoogleMapsAPIUrl = Telerik.Events.Configuration.ConfigHelper.Handler.GoogleMapsAPIUrl;
             var YahooMapsAPIKey = Telerik.Events.Configuration.ConfigHelper.Handler.YahooMapsAPIKey;
              var YahooMapsAPIUrl = Telerik.Events.Configuration.ConfigHelper.Handler.YahooMapsAPIUrl;
              var  = Telerik.Events.Configuration.ConfigHelper.Handler.LiveSearchMapsAPIUrl;

    EventsManager expose public properties like
    GeomappingDataField - Gets the name of the meta field that is used as GeomappingData

    GoogleMapsEnabled - Gets boolean value determining if google geomapping service is enabled and can be used.

    Anyhow, if the above does not help you, please write back to me and let me know what data you want to retrive and from where you are trying to get it.

    Kind regards,

    Ivan Dimitrov
    the Telerik team

     


    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. LBrinley
    LBrinley avatar
    59 posts
    Registered:
    29 Dec 2005
    25 Mar 2010
    Link to this post
    Thanks, Ivan.  In response to a client's request for automation of a custom implementation of the Events module I've developed, I need to be able to programmatically create and save 'Events' to the database, as well as support individual editing of 'Events' via the Admin Interface.  I'm able to populate all the fields/metafields of the EventsItemEdit/EventsItemNew controls programmatically, but I am NOT able to update the Lattitude/Longitude upon a change of the entered Street,City,Country and State values, unless I click the 'LnkAcquireGeomappingData' link button manually.  The public EventsView control is NOT an issue for me.

    I've reviewed the Telerik.Events.WebControls.Admin namespace documentation. I've manually set the Street, City, Country and State properties of the GeoMappingEditor control and have played with the CreateGeomappingData and SetGeomappingData methods (although the documentation doesn't describe what these do), as well as tried the methods described in the orignial posting, but I can NOT get the GeomappingEditor control to retrieve the Lattitude/Longitude from GoogleMaps programmatically.

    Since the client wants the bulk of the custom module's entries to be made without ANY human intervention/action, I need to be able to get the data back from GoogleMaps completely programmatically.  Is this possible within the EventItemEdit/EventItemNew controls?

    If not, I'll roll my own means of retrieving the data from GoogleMaps programmatically.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    30 Mar 2010
    Link to this post
    Hi iVillageIdiot,

    If you create a custom views for EventsItemEdit and EventsItemNew you should be able to access the Geomapping data before saving the content. Below is a sample code that illustrates this

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Events.WebControls.Admin;
     
    /// <summary>
    /// Summary description for EventsItemEditCustom
    /// </summary>
    public class EventsItemEditCustom : EventsItemEdit
    {
        public EventsItemEditCustom()
        {
        }
     
        public override string LayoutTemplatePath
        {
            get
            {
                return "~/Sitefinity/Admin/ControlTemplates/Events/EventsItemEdit.ascx";
            }
     
        }
     
        protected override void SaveContent()
        {
            string latitude = this.GeomappingData.GeoLatitude.Text;
            string longtude = this.GeomappingData.GeoLongitude.Text;
            base.SaveContent();
      
        }
    }

    You have to replace the default view with a custom one .

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. LBrinley
    LBrinley avatar
    59 posts
    Registered:
    29 Dec 2005
    31 Mar 2010
    Link to this post
    Thanks, Ivan.
Register for webinar
5 posts, 0 answered