AnsweredAssumed Answered

Using British National Grid Data with ArcGIS Server Google Maps Extension

Question asked by djh78 on Feb 24, 2013
Latest reply on Feb 28, 2013 by djh78

I am pretty new to this end of things. I have created some code using various sources to create a map window which uses the Google maps extension to plot data from my ArcGIS Server within the view window, and then allow users to click on a record and retirieve attributes of each record.

My problem is the data is mis-aligned (varies slightly but is approx 120 metres off) which I am assuming id down to the chane between projection systems for each. (As I am in the UK we use British National Grid, and google maps uses WGS1984).

Googlemaps is the preferred background, so is there any way to ensure the data line up as it should? See code below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ""> <html debug=true>   <head>     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />     <title>DH Test - Return Data from ArcGIS Server</title>      <script src=""type="text/javascript"></script>      <script src="" type="text/javascript" ></script>      <script type="text/javascript">        var gmap = null;       var qtask = null;       var query = null;       var mapExtension = null;       var gOverlays = null;        function initialize() {         // GMap construction         gmap = new GMap2(document.getElementById('gmap'));         gmap.addMapType(G_NORMAL_MAP);         gmap.addMapType(G_SATELLITE_MAP);         gmap.addControl(new GLargeMapControl());         gmap.addControl(new GMapTypeControl());         gmap.setCenter(new GLatLng(53.5167, -1.1333), 10);         gmap.enableScrollWheelZoom();           //Create MapExtension utility class         mapExtension = new esri.arcgis.gmaps.MapExtension(gmap);           // Query Task         qtask = new esri.arcgis.gmaps.QueryTask("http://gisfusinternet/ArcGIS/rest/services/GoogleTest/MapServer/0");          // You can execute a task and listen for the complete event or use the callback to get the results         GEvent.addListener(qtask, "executecomplete", function() {           //console.debug("'query task complete' event fired!!!");         });          // Query         query = new esri.arcgis.gmaps.Query();       }        function executeQuery() {         var bounds = gmap.getBounds();          // clear map overlays and event listeners using MapExtension removeFromMap         mapExtension.removeFromMap(gOverlays);          // set query parameters         query.queryGeometry = bounds;         query.returnGeometry = true;   query.outFields = ["SYMLINK", "UNITNO"];          // execute query task         qtask.execute(query, false, mycallback);        }        function mycallback(fset) {         //JS literal class esri.arcgis.gmaps.OverlayOptions         var overlayOptions = {           strokeColor:"#FF0000",           strokeWeight:3,           strokeOpacity:0.75,           fillColor:"#000066",           fillOpacity:0.4         };          //JS literal class esri.arcgis.gmaps.InfoWindowOptions without tabs         var infoWindowOptions = {           content:"<p>UNITID = <b>{SYMLINK}</b></br>Column Number = <b>{UNITNO}</b></p>"         };          gOverlays = mapExtension.addToMap(fset,overlayOptions,infoWindowOptions);       }      </script>    </head>    <body onload="initialize();" onunload="GUnload();">   <table width="100%" height="100%">     <tr>       <td align="center">          <table>           <tr align="left">             <td>               <input type="button" value="Execute Query" onclick="executeQuery();" />                 <input type="button" value="Clear Map Overlays" onclick="mapExtension.removeFromMap(gOverlays);" />             </td>           </tr>            <tr align="left" valign="top">             <td>               <div id="gmap" style="width: 500px; height:500px;"></div>             </td>           </tr>           </table>        </td>     </tr>   </table>   </body> </html> 

Alternatively, how would I do the same using background maps on my own server if this is not possible?