我有这段代码应该使用 LatLng 在地图上放置一个标记
...
geocoder = Geocoder.create();
myOptions = MapOptions.create();
myOptions.setZoom(18);
myOptions.setMapTypeId(MapTypeId.HYBRID);
myOptions.setMapMaker(true);
map = GoogleMap.create(
Document.get().getElementById("map_canvas"),myOptions);
location = LatLng.create(45.48592686713835,-73.49009937672122);
map.setCenter(location.getGeometry().getLocation());
marker = Marker.create();
marker.setMap(map);
marker.setPosition(location.getGeometry().getLocation());
location = LatLng.create(45.48592686713835,-73.49009937672122);
map.setCenter(location.getGeometry().getLocation());
marker = Marker.create();
marker.setMap(map);
marker.setPosition(location.getGeometry().getLocation());
但相反,我得到了一个例外。%20
经度前面好像有一个
有 StackTrace
Caused by: com.google.gwt.core.client.JavaScriptException: (Error): Invalid value for property <center>: http://127.0.0.1:8888/m3t/hosted.html?m3t
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
at com.google.maps.gwt.client.GoogleMap$.setCenter$(GoogleMap.java)
at com.tb.ttt.client.view.component.Map.setMarker(Map.java:121)
at com.tb.ttt.client.view.component.Map.codeAddress(Map.java:110)
at com.tb.ttt.client.view.component.Map.setData(Map.java:85)
at com.tb.ttt.client.view.component.PopupMap.onAttach(PopupMap.java:95)
at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:475)
at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:127)
at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:97)
at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:97)
at com.google.gwt.user.client.ui.PopupPanel$ResizeAnimation.onInstantaneousRun(PopupPanel.java:344)
at com.google.gwt.user.client.ui.PopupPanel$ResizeAnimation.setState(PopupPanel.java:239)
at com.google.gwt.user.client.ui.PopupPanel.show(PopupPanel.java:1010)
at com.google.gwt.user.client.ui.PopupPanel.center(PopupPanel.java:523)
at com.tb.ttt.client.view.component.PopupMap.<init>(PopupMap.java:65)
at com.tb.ttt.client.presenter.HpParamImmPresenter$3.onClick(HpParamImmPresenter.java:140)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
... 31 more
[WARN] 404 - GET /(45.48592686713835,%20-73.49009937672122) (127.0.0.1) 1427 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://127.0.0.1:8888/m3t/hosted.html?m3t
Cookie: JSESSIONID=1lkcmpo9v6f8j
Response headers
Content-Type: text/html; charset=iso-8859-1
Content-Length: 1427