<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false"
type="text/javascript"></script>
<script src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.6"
type="text/javascript" ></script>
<script type="text/javascript">
function initialize() {
var mapext = null;
var gsvc;
var buffParams;
var myMap = new GMap2(document.getElementById("map_canvas"));
myMap.setCenter(new GLatLng(48,-82), 2);
var polyOptions = {geodesic:true};
polyline = new GPolyline([
new GLatLng(80,-80),
new GLatLng(60,-80),
new GLatLng(30,-80),
new GLatLng(0,-80)
], "#ff0000", 3, 1, polyOptions);
myMap.addOverlay(polyline);
mapext = new esri.arcgis.gmaps.MapExtension(myMap);
gsvc = new esri.arcgis.gmaps.Geometry("http://sampleserver1.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer/");
buffParams = new esri.arcgis.gmaps.BufferParameters();
buffParams.unit = esri.arcgis.gmaps.SRUnitType.METER;
buffParams.unionResults = true;
buffParams.distances = [277800];
buffParams.geometries = [polyline];
gsvc.buffer(buffParams,function(results) {
mapext.addToMap(results);
});
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 100%; height: 100%"></div>
</body>
</html>Thanks for your reply, Annette. I tried using spatial reference 54032 with the Google Maps API, and that actually caused the returned buffer to compensate longitudinally. The E-W distance were of the proper size. However, it remained too small with respect to the N-S distances from the line that was being buffered. Based on that, I tried a few other references. Some were fairly accurate, so I'm pretty sure that it is, indeed, a problem with the spatial reference. Based on my research, Google Maps seems to use a form of Mercator, so I started trying anything from the supported list (http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi_start.htm#jsapi/sp...) that was a Mercator.
Here's where things get odd. I meant to try 3349 - WGS_1984_PDC_Mercator, but I made a typo and ended up putting 3394, which is apparently Nahrwan_1934_Iraq_Zone. But oddly enough, it's really close. I mean really. Around the US/Canada border the margin of error is about 5 Nautical Miles, up near 50N, it's only off by about 12 Nautical Miles. That's much better than the 60% margin of error I was seeing with 102100 which was listed as the WKID of Google Maps on multiple ArcGIS and ERSI pages. I'm a little concerned that an Iraq Zone projection from 1934 seems to be the closest spatial reference available, and I would hate for someone to attempt to buffer an area outside of what I have tested unaware that it may be nowhere near true. I'm hoping you can shed some light on the situation.
I realize that "measurements" of distance shouldn't be done on a Mercator, but as I am not measuring but simply buffering a line, I would assume that the ArcGIS server takes this into account to calculate the buffer when passed the proper (Web Mercator) spatial reference. So I remain confused as to why 102100 doesn't result in a proper buffer, and even more confused why a projection from Iraq in 1934 does.