Post new topic Reply to topic  [ 4 posts ] 

Board index : GWT-Ext Forums : GWT-Ext 2.x Discussion

Author Message
 Post subject: Gwt-Ext 2.0.3: Accessing Mapstraction API functions
PostPosted: Mon Apr 07, 2008 6:32 am 
Offline

Joined: Mon Mar 10, 2008 7:21 am
Posts: 202
I want to geocode an address and obtain its latitude and longitude values.
Are there API calls for accessing the Mapstraction functions? Or do I need JSNI for calling Javascript functions to geocode addresses?

Regards,
Abhijeet Maharana.

_________________
Gwt-Ext docs: http://gwt-ext.com/docs/2.0.4/
Your question may have been answered already: viewforum.php?f=9


Back to top
 Profile  
 
 Post subject: Re: Gwt-Ext 2.0.3: Accessing Mapstraction API functions
PostPosted: Mon Apr 07, 2008 9:13 pm 
Offline

Joined: Mon Mar 10, 2008 7:21 am
Posts: 202
Some more info: I was able to get this Google Maps specific code running.
Code:
public native void updateMap(String locationAddress, JavaScriptObject llp, MainModule thisModule) /*-{
   var geo = new $wnd.GClientGeocoder();

   geo.getLocations(locationAddress,
      function(response)       // callback method to be executed when result arrives from server
      {
         if (!response || response.Status.code != 200)
         {
               alert("Unable to geocode that address");
         }
         else
               {
                var place = response.Placemark[0];
                llp.lat = place.Point.coordinates[1];
                llp.lon = place.Point.coordinates[0];
thisModule.@com.maharana.gwtextmaps.client.MainModule::renderMap(Lcom/google/gwt/core/client/JavaScriptObject;)(llp);
               }
            }
         );
}-*/;


public void renderMap(JavaScriptObject jsObj)
{
   double lat = Double.parseDouble(JavaScriptObjectHelper.getAttribute(jsObj, "lat"));
   double lon = Double.parseDouble(JavaScriptObjectHelper.getAttribute(jsObj, "lon"));

   LatLonPoint latLonPoint = new LatLonPoint(lat, lon);
   mapPanel.setCenterAndZoom(latLonPoint, 12);
   mapPanel.addMarker(new Marker(latLonPoint));
}

And the call to updateMap():
Code:
updateMap("mumbai", JavaScriptObjectHelper.createObject(), this);

I want to eliminate the JSNI method. Any suggestions?

-- Abhijeet Maharana.

_________________
Gwt-Ext docs: http://gwt-ext.com/docs/2.0.4/
Your question may have been answered already: viewforum.php?f=9


Back to top
 Profile  
 
 Post subject: Re: Gwt-Ext 2.0.3: Accessing Mapstraction API functions
PostPosted: Mon Apr 07, 2008 11:52 pm 
Offline
Site Admin

Joined: Fri Dec 14, 2007 12:27 pm
Posts: 1017
Abhijeet,
Geocoding is not yet part of mapstraction, but I'll try to incorprorate your code into a Google specific class implmentation, and over time add implementations for other map providers.

btw great blog entry on the introduction to gwt-ext and maps

http://abhijeetmaharana.com/blog/2008/0 ... ogle-maps/

It would be great if you can add a this link to this URL in the GWT-Ext wiki along with your tips blog entry. I think many users can benefit from it.


btw a little tip on using Google maps is that you can always use the following key when working in host mode since the url is localhost:8888

Code:
<script type="text/javascript"
src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAARrCK38aboqQKDotehUjrPhTb-vLQlFZmc2N8bgWI8YDPp5FEVBQ-MFjXfKfAvdbsbp3pa0q7fQNDDA"></script>


Thanks,
Sanjiv


Back to top
 Profile  
 
 Post subject: Re: Gwt-Ext 2.0.3: Accessing Mapstraction API functions
PostPosted: Tue Apr 08, 2008 1:29 am 
Offline

Joined: Mon Mar 10, 2008 7:21 am
Posts: 202
Ah! That clears my doubt. Will have to live with JSNI for the moment.
Ill update the wiki.

It seems that Mapstraction has partial support for geocoding or it is work in progress. It does provide MapstractionGeocoder which appears in the http://mapstraction.com/svn/source/mapstraction-geocode.js file. There is also a demo at http://mapstraction.com/geocode.php?geo ... p=mapquest.

However, it has support only for Google and Mapquest. And it also does not appear in the API documentation at http://mapstraction.com/doc/.

Thanks,
Abhijeet Maharana.

_________________
Gwt-Ext docs: http://gwt-ext.com/docs/2.0.4/
Your question may have been answered already: viewforum.php?f=9


Back to top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

Board index : GWT-Ext Forums : GWT-Ext 2.x Discussion


Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Style by Midnight Phoenix & N.Design Studio
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.