You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dirk Forchel <di...@exedio.com> on 2013/10/16 13:03:28 UTC

gmap3 Geocoder and list of locations

Hi,
I'm a newbie to all the Google Maps API stuff and I've noticed that a
wicket-stuff project (gmap3) could help me to show a Google Map with a list
of shops for a known business company. I found an example on this french
page http://www.bebecash.com/Magasins/ which is similar to our  tasks. And I
know it exists a geocode example within the wicket-stuff gmap3 project
which, I think, is a good starting point. 
What would be the prefered way to feed the GeoCoder with the location data?
And what is the right way to hook in my data.
Any hints?
Thanks,
  Dirk



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: gmap3 Geocoder and list of locations

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Oct 21, 2013 at 10:08 AM, Dirk Forchel <di...@exedio.com>wrote:

> Yes, I've already tried this, but unfortunately it was not working. But I
> found the problem by myself.
>
> My first try (not working):
>
> GMarker marker = new GMarker(new GMarkerOptions(map, location, "click
> here"));
> marker.addListener(GEvent.click, getClickHandler());
> map.addOverlay(marker);
>
> My second try (working):
>
> GMarker marker = new GMarker(new GMarkerOptions(map, location, "click
> here"));
> map.addOverlay(marker);
> // IMPORTANT: first add the marker to the map
>

Yes. I've seen a comment in the code about this requirement.


> marker.addListener(GEvent.click, getClickHandler());
>
> Thank you anyway.
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836p4661893.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: gmap3 Geocoder and list of locations

Posted by Dirk Forchel <di...@exedio.com>.
Yes, I've already tried this, but unfortunately it was not working. But I
found the problem by myself.

My first try (not working):

GMarker marker = new GMarker(new GMarkerOptions(map, location, "click
here"));			
marker.addListener(GEvent.click, getClickHandler());
map.addOverlay(marker);

My second try (working):

GMarker marker = new GMarker(new GMarkerOptions(map, location, "click
here"));			
map.addOverlay(marker);
// IMPORTANT: first add the marker to the map
marker.addListener(GEvent.click, getClickHandler());

Thank you anyway.




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836p4661893.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: gmap3 Geocoder and list of locations

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can use org.wicketstuff.gmap.api.GOverlay#addListener(GEvent event,
GEventHandler handler)


On Mon, Oct 21, 2013 at 9:20 AM, Dirk Forchel <di...@exedio.com>wrote:

> Hi Martin,
> there is still an open issue with showing the marker for all stores and an
> appropriate info window. Actually I wanna do something like the following
> Javascript code but in Java:
>
> // Init a new map
> var map = new GMap2(document.getElementById('map'));
> map.addControl(new GSmallMapControl());
> map.setCenter(new GLatLng(56.87, 14.80), 11);
> // Creating a new marker
> var marker = new GMarker(new GLatLng(56.87, 14.80))
> // Adding a click-event to the marker
> GEvent.addListener(marker, 'click', function() {
>   // When clicked, open an Info Window
>   marker.openInfoWindowHtml('Some text');
> });
> // Add marker to map
> map.addOverlay(marker);
>
> I'm not able to add the click-event to the marker and show the info window
> with the store info (see also
>
> https://developers.google.com/maps/documentation/javascript/v2/reference?hl=de&csw=1#GMarker
> ).
> I'm just able to add click-events to the map itself. How could I do that?
> Thank you.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836p4661889.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: gmap3 Geocoder and list of locations

Posted by Dirk Forchel <di...@exedio.com>.
Hi Martin,
there is still an open issue with showing the marker for all stores and an
appropriate info window. Actually I wanna do something like the following
Javascript code but in Java:

// Init a new map
var map = new GMap2(document.getElementById('map'));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(56.87, 14.80), 11);
// Creating a new marker
var marker = new GMarker(new GLatLng(56.87, 14.80))
// Adding a click-event to the marker
GEvent.addListener(marker, 'click', function() {
  // When clicked, open an Info Window
  marker.openInfoWindowHtml('Some text');
});
// Add marker to map
map.addOverlay(marker);

I'm not able to add the click-event to the marker and show the info window
with the store info (see also
https://developers.google.com/maps/documentation/javascript/v2/reference?hl=de&csw=1#GMarker).
I'm just able to add click-events to the map itself. How could I do that?
Thank you.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836p4661889.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: gmap3 Geocoder and list of locations

Posted by Martin Grigorov <mg...@apache.org>.
I think the best would be to render markers for all stores and center the
map according to the zipcode and zoom it appropriately.
This way the user will see only the stores in the visible area of the map.
But if (s)he zoom out the map then (s)he will see more stores and choose
any of them.
Otherwise you will have to listen for bounds_changed event and add/remove
markers dynamically.


On Thu, Oct 17, 2013 at 3:28 PM, Dirk Forchel <di...@exedio.com>wrote:

> OK, sounds reasonable. Is there a way to return only these stores with
> their
> coordinates (GLatLng) which fit into a special bound. I mean, the user
> types
> in a region or postcode and wants to so only thouse stores which fit into
> this bound. How could I perform this?
> Thanks in advance.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836p4661855.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: gmap3 Geocoder and list of locations

Posted by Dirk Forchel <di...@exedio.com>.
OK, sounds reasonable. Is there a way to return only these stores with their
coordinates (GLatLng) which fit into a special bound. I mean, the user types
in a region or postcode and wants to so only thouse stores which fit into
this bound. How could I perform this?
Thanks in advance.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836p4661855.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: gmap3 Geocoder and list of locations

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Oct 17, 2013 at 2:14 PM, Dirk Forchel <di...@exedio.com>wrote:

> Hi Martin,
> thanks for your answer. Actually, all of our "stores" are persistent in our
> database. These are about 300 and I think it is a good idea to pre-compute
> all the coordinates (GLatLng) with a cronjob. Afterwards I would like to
> show only a part of these stores which fit to a certain specific pattern
> (e.g. post code or region or whatever). The result list of these stores
> taken from the database should be shown. So I think it is a good idea to to
> call serverGeocoder.findAddress(address) from the cronjob, store the
> GLatLng
> values in the database along with the address. What do you think?
>

I guess there is no reason of a cron job too.
Since the stores do not change frequently it is OK just to put their
coordinates in the DB and update them when there is a change.


>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836p4661850.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: gmap3 Geocoder and list of locations

Posted by Dirk Forchel <di...@exedio.com>.
Hi Martin,
thanks for your answer. Actually, all of our "stores" are persistent in our
database. These are about 300 and I think it is a good idea to pre-compute
all the coordinates (GLatLng) with a cronjob. Afterwards I would like to
show only a part of these stores which fit to a certain specific pattern
(e.g. post code or region or whatever). The result list of these stores
taken from the database should be shown. So I think it is a good idea to to
call serverGeocoder.findAddress(address) from the cronjob, store the GLatLng
values in the database along with the address. What do you think?



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836p4661850.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: gmap3 Geocoder and list of locations

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

String address = ...
GLatLng latLng = serverGeocoder.findAddress(address);
map.addOverlay(new GMarker(latLng));


On Wed, Oct 16, 2013 at 2:03 PM, Dirk Forchel <di...@exedio.com>wrote:

> Hi,
> I'm a newbie to all the Google Maps API stuff and I've noticed that a
> wicket-stuff project (gmap3) could help me to show a Google Map with a list
> of shops for a known business company. I found an example on this french
> page http://www.bebecash.com/Magasins/ which is similar to our  tasks.
> And I
> know it exists a geocode example within the wicket-stuff gmap3 project
> which, I think, is a good starting point.
> What would be the prefered way to feed the GeoCoder with the location data?
> And what is the right way to hook in my data.
> Any hints?
> Thanks,
>   Dirk
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/gmap3-Geocoder-and-list-of-locations-tp4661836.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>