POST
|
Hi srikanthgkp463, this is basically what i wanted.. but i would want the user to input the values of the coordinates instead of drawing it out... For example: a person enter the x and y coordinates of the point that he want to buffer.. Thanks 😄
... View more
06-03-2012
07:14 PM
|
0
|
0
|
698
|
POST
|
Hi srikanthgkp463, The methods that you have given, actually I have tested it out and it doesn't work... This is my coding based on the sample, i have only made changes to the params.geometries: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title>Buffer</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css"> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8" type="text/javascript"></script> <script type="text/javascript"> dojo.require("esri.map"); dojo.require("esri.tasks.geometry"); var map = null; var gsvc = null; function initialize() { map = new esri.Map("map"); var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"); map.addLayer(layer); map.setExtent(esri.geometry.geographicToWebMercator(new esri.geometry.Extent(-97.76, 32.32, -96.11, 33.42, new esri.SpatialReference({wkid: 4326})))); gsvc = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); dojo.connect(map, "onClick", doBuffer); } function doBuffer() { map.graphics.clear(); var point = new esri.geometry.Point( {"x": -122.65, "y": 45.53," spatialReference": {" wkid": 4326 } }); var params = new esri.tasks.BufferParameters(); params.geometries = [ point ]; //buffer in linear units such as meters, km, miles etc. params.distances = [ 5, 10 ]; params.unit = esri.tasks.GeometryService.UNIT_KILOMETER; params.outSpatialReference = map.spatialReference; gsvc.buffer(params, showBuffer); } function showBuffer(geometries) { var symbol = new esri.symbol.SimpleFillSymbol( esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol( esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0,0,255,0.65]), 2 ), new dojo.Color([0,0,255,0.35]) ); dojo.forEach(geometries, function(geometry) { var graphic = new esri.Graphic(geometry,symbol); map.graphics.add(graphic); }); } dojo.addOnLoad(initialize); </script> </head> <body class="claro"> <table style="width:515px"> <tr> <td>Click a location on the map to buffer. Click again on another location to buffer again. <div id="map" style="width:600px; height:400px; border:1px solid #000;"></div> </td> </tr> </table> </body> </html> I do not know which part is causing the buffer to not work... Thanks alot and i am from Singapore. 🙂
... View more
05-31-2012
10:34 PM
|
0
|
0
|
698
|
POST
|
Hi srikanthgkp463, thanks for your reply! But how do i create a mapPoint with the input values? var x = document.getElementById("x").value var y = document.getElementById("y").value var mapPoint = x, y; var params = new esri.tasks.BufferParameters(); params.geometries = [ mapPoint ]; Is it something like that? Thanks 😄
... View more
05-31-2012
09:32 PM
|
0
|
0
|
698
|
POST
|
Hi Chris, This is almost similar to what I want... But I would want the user to be able to input their own coordinates rather than clicking on the map to let the buffer work... Can i change the params.geometries = [ evt.mapPoint ] to params.geometries = [ point ], will it be able to work ? Thanks 😄
... View more
05-31-2012
04:55 PM
|
0
|
0
|
698
|
POST
|
Hi all, is it possible to buffer a user-input coordinates for 1 kilometer? I have been figuring it for one week but then I can't seem to get it work. Thanks 😄
... View more
05-30-2012
09:50 PM
|
0
|
8
|
1203
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|