You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Doug Leeper <do...@yahoo.com> on 2008/10/08 18:59:12 UTC
initial GMap2 bounds question
Lets say I have two GLatLng Points, i.e. Chicago and Indianapolis. I would
like to have the map be centered between these points and bounded to show
these points.
What is the best way to do this?
--
View this message in context: http://www.nabble.com/initial-GMap2-bounds-question-tp19883071p19883071.html
Sent from the Wicket - User 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: initial GMap2 bounds question
Posted by Antony Stubbs <an...@gmail.com>.
Thanks guys!
patched - http://wicketstuff.org/jira/browse/WSGMAPP-7
Martin Funk-3 wrote:
>
> Sven Meier wrote:
>> Regretfully there's no direct API call in GMap2 supporting your case.
>>
>> Here's a description how to do it with Javascript only:
>> http://econym.googlepages.com/basic14.htm
>>
>> We could make up a function that hides the details:
>>
>> GMap2#fitMarkers(List<Marker>)
>>
>> Martin, what do you think?
> Sounds fine by me.
> We even have an (quite old) jira issue on this.
> http://wicketstuff.org/jira/browse/WSGMAPP-7
>
> mf
>>
>> Sven
>>
>> Doug Leeper schrieb:
>>> Lets say I have two GLatLng Points, i.e. Chicago and Indianapolis. I
>>> would
>>> like to have the map be centered between these points and bounded to
>>> show
>>> these points.
>>>
>>> What is the best way to do this?
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
-----
___________________________
http://stubbisms.wordpress.com http://stubbisms.wordpress.com
--
View this message in context: http://www.nabble.com/initial-GMap2-bounds-question-tp19883071p22259983.html
Sent from the Wicket - User 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: initial GMap2 bounds question
Posted by Martin Funk <ma...@googlemail.com>.
Sven Meier wrote:
> Regretfully there's no direct API call in GMap2 supporting your case.
>
> Here's a description how to do it with Javascript only:
> http://econym.googlepages.com/basic14.htm
>
> We could make up a function that hides the details:
>
> GMap2#fitMarkers(List<Marker>)
>
> Martin, what do you think?
Sounds fine by me.
We even have an (quite old) jira issue on this.
http://wicketstuff.org/jira/browse/WSGMAPP-7
mf
>
> Sven
>
> Doug Leeper schrieb:
>> Lets say I have two GLatLng Points, i.e. Chicago and Indianapolis. I
>> would
>> like to have the map be centered between these points and bounded to
>> show
>> these points.
>>
>> What is the best way to do this?
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: initial GMap2 bounds question
Posted by Doug Leeper <do...@yahoo.com>.
I achieved what I was looking for. Here is what I did:
map.add(new HeaderContributor(new IHeaderContributor()
{
private static final long serialVersionUID = 1L;
public void renderHead(IHeaderResponse response)
{
StringBuffer buf = new StringBuffer();
buf.append( "var bounds = new GLatLngBounds();\n");
buf.append( "var map = " + map.getJSinvoke("map" ) );
for (CustomLocation custom : location.getCustomLocations()) {
GLatLng point = new GLatLng(custom.getLatitude(), custom
.getLongitude());
buf.append( "bounds.extend( " + point.getJSconstructor() + " );\n" );
}
buf.append( "map.setZoom( map.getBoundsZoomLevel(bounds) );\n" );
buf.append( "map.setCenter( bounds.getCenter() );\n");
response.renderOnDomReadyJavascript(buf.toString());
}
}));
location is my data object that contains all my specific custom locations.
Works like a charm!
--
View this message in context: http://www.nabble.com/initial-GMap2-bounds-question-tp19883071p19886673.html
Sent from the Wicket - User 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: initial GMap2 bounds question
Posted by Sven Meier <sv...@meiers.net>.
Regretfully there's no direct API call in GMap2 supporting your case.
Here's a description how to do it with Javascript only:
http://econym.googlepages.com/basic14.htm
We could make up a function that hides the details:
GMap2#fitMarkers(List<Marker>)
Martin, what do you think?
Sven
Doug Leeper schrieb:
> Lets say I have two GLatLng Points, i.e. Chicago and Indianapolis. I would
> like to have the map be centered between these points and bounded to show
> these points.
>
> What is the best way to do this?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org