Re: Dynamically add markers to a Map

100 views
Skip to first unread message

Hazem Saleh

unread,
Apr 26, 2013, 11:27:02 AM4/26/13
to gmaps4jsf-dev
In order to get Mashup Location information, you can use the Location Service Wrapper which is provided by the Mashups4JSF (http://code.google.com/p/mashups4js) project as shown in the source code example here:
https://code.google.com/p/mashups4jsf/source/browse/trunk/core/src/test/java/com/googlecode/mashups/services/unittests/LocationServiceTest.java

Check the second testGetLocationFromAddress() test method.

So in summary:
1. Download Mashups4JSF 3.0.0 jar from (or include its Maven Dependency):
https://code.google.com/p/mashups4jsf/downloads/list

2. On the command Action, call LocationService:
Location location = locationService.getLocationFromAddress("NY, NY");
//Then use location.getLongtiude and location.getLatitude() to do your business logic.

This is all about.



On Thu, Apr 25, 2013 at 11:13 PM, Daniel Dausch <d.dau...@gmail.com> wrote:
I have a requirement where a person would enter in an address (e.g. NY,NY) and then a map would be displayed similar to the demo page "getMyLocation.xhtml". Beyond that basic functionality however, is that I would like to utilize the Lat and Lon of that address, query my database of my Properties and then add markers to the map of those Properties that are within 200 miles of that address. I am assuming I would have to use event listeners to do this but it is not clear to me the order of operations since I don't know the Lat and Lon intially. I know how to add a set of markers using ui:repeat with a list from a Backing Bean so that part is clear to me. Any thoughts?

--
You received this message because you are subscribed to the Google Groups "gmaps4jsf-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gmaps4jsf-de...@googlegroups.com.
To post to this group, send email to gmaps4...@googlegroups.com.
Visit this group at http://groups.google.com/group/gmaps4jsf-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Hazem Ahmed Saleh Ahmed

Author of JavaScript Unit Testing book:
http://www.amazon.com/dp/1782160620/

Co-author of (The Definitive Guide to Apache MyFaces and Facelets) book:
http://www.amazon.com/-/e/B002M052KY

DeveloperWorks Contributing Author
https://www.ibm.com/developerworks/mydeveloperworks/blogs/hazem/entry/ibm_developerworks_contributing_author?lang=en_us

An Apache committer, IBMer, and a technical speaker

Twitter: http://www.twitter.com/hazems

Hazem Saleh

unread,
Apr 29, 2013, 1:15:22 PM4/29/13
to gmaps4jsf-dev
Your app is running behind a firewall or proxy.

Can you ping http://maps.googleapis.com/maps/api/geocode?



On Mon, Apr 29, 2013 at 7:13 PM, Daniel Dausch <d.dau...@gmail.com> wrote:
Thanks for the info Hazem. I followed your instructions although I did not see a 3.0 jar, just a 1.0 jar for Mashups4jsf. The sample code was self-explanatory. However, when running my app when making the call: locationService.getLocationFromAddress(..) , I am receiving: java.net.ConnectException: Connection timed out. Any thoughts as to why? Is there a URL I need to configure? I looked at the source code for Location Service and it looks like the URL is embedded in it: http://maps.googleapis.com/maps/api/geocode so it is not clear how to proceed. Many thanks.




On Thursday, April 25, 2013 5:13:25 PM UTC-4, Daniel Dausch wrote:
I have a requirement where a person would enter in an address (e.g. NY,NY) and then a map would be displayed similar to the demo page "getMyLocation.xhtml". Beyond that basic functionality however, is that I would like to utilize the Lat and Lon of that address, query my database of my Properties and then add markers to the map of those Properties that are within 200 miles of that address. I am assuming I would have to use event listeners to do this but it is not clear to me the order of operations since I don't know the Lat and Lon intially. I know how to add a set of markers using ui:repeat with a list from a Backing Bean so that part is clear to me. Any thoughts?

--
You received this message because you are subscribed to the Google Groups "gmaps4jsf-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gmaps4jsf-de...@googlegroups.com.
To post to this group, send email to gmaps4...@googlegroups.com.
Visit this group at http://groups.google.com/group/gmaps4jsf-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hazem Saleh

unread,
Apr 29, 2013, 1:52:03 PM4/29/13
to gmaps4...@googlegroups.com, gmaps4...@googlegroups.com
Great

Sent from my iPhone

On Apr 29, 2013, at 9:25 PM, Daniel Dausch <d.dau...@gmail.com> wrote:

I was suspecting a firewall issue. I am running in SpringSourceTool Suite with the embedded Tomcat Server. I am researching how to set a proxy currently. I opened up a command window and tried ping and received ping request could not find host.

Hazem Saleh

unread,
May 3, 2013, 10:06:52 AM5/3/13
to gmaps4...@googlegroups.com, gmaps4...@googlegroups.com
Please let us know if you are using GMaps4JSF in a real business application to add it to the wiki.

Questions about GMaps4JSF for real business applications usually have faster response.

Sent from my iPhone

On May 3, 2013, at 4:41 PM, Daniel Dausch <d.dau...@gmail.com> wrote:

Thanks for the details on using the Location Service Wrapper. After figuring out how to configure the proxy setting I am able to get the desired data. Thanks.

Hazem Saleh

unread,
May 6, 2013, 8:44:06 AM5/6/13
to gmaps4...@googlegroups.com, gmaps4...@googlegroups.com
No problems at all. Enjoy using GMaps4JSF. 

Sent from my iPhone

On May 6, 2013, at 3:58 PM, Daniel Dausch <d.dau...@gmail.com> wrote:

The app will be for internal company usage only - sorry.
Reply all
Reply to author
Forward
0 new messages