I am a real newbie in programming and now I have to combine Google Maps and Dojo. Both alone are fine but when I try to implement a Google Map into a Dojo content pane which is embedded in a border-container it simply does not work. I think there is a pro开发者_如何学运维blem with the naming of the divs but perhaps there is something else to take care of?
Could someone post the simplest possible solution?
many thanks
I was able to figure it out myself.
Here is the answer: Actually I was going to use ArcGIS Server Javascript extension for GoogleMaps and Dojo together. Thus we have to sure that all references to APIs are made correctly.
I think it is wise to use the Dojo components directly from the ArcGIS Server-API pages instead of loading from the DOJO network. This should guarantee the compatability between all components.
<!--Load Google Maps API -->
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA22G6YWIfghc6CfXo3jGlQBQIhNZriPAS64ZF0ztgQFnJUtUvlhSuBly8ueb8pLmxY8qzKANsSXJhUA" type="text/javascript"></script>
<!--load arcgis-javascript for googlemaps api -->
<script src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.4" type="text/javascript" ></script>
<!--load arcgis js api -->
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.4"></script>
<!--load the required Dojo components -->
<script type="text/javascript">
dojo.require("dojox.data.XmlStore");
dojo.require("dojox.grid.DataGrid");
<!--This loads the esri specific geoprocessing tool -->
dojo.require("esri.tasks.gp");
<!-- defining variables -->
var gmap = null;
var dynMapOv = null;
</script>
Then, after the initializing function is set up...
function initialize() {
//Load Google Maps
gmap = new GMap2(document.getElementById("gmap"));
var centerat = new GLatLng(-1, 23.7);
gmap.setCenter(centerat, 3); ...
... one has to ensure load the function with
dojo.addOnLoad(initialize);
Furthermore, it is important to put a reference to the the dojo-theme in the body tag of the HTML code.
<body class="soria" onunload="GUnload();">
I hope this very basic stuff helps someone who is not sure about how to combine AGS+GoogleMaps+Dojo.
精彩评论