|
POST
|
Thanks Heming, I looked up ARcGIS resource Center but could not find any example to use esri.graphicsExtent function. I'll really appreciate it if you can guide me a bit more. Thanks Samir Here is link: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/namespace_esri.htm#esri.graphicsExtent . could use this method like this. var extent =esri.graphicsExtent(map.graphics.graphics)... map.setExtent(extent).
... View more
02-23-2011
06:01 AM
|
0
|
0
|
2111
|
|
POST
|
Hi, I am running a query to select a number of polygons based on an intersecting polygon. The selected polygons are contiguous and are highlighted when the query is complete. I am trying to set the map extent to the extent of all these polygons combined together but have been unsuccessful. I have tried suggestions posted on these forums and using samples provided by ESRI but am still unable to get the map to zoom to this area. I have tried creating an array to push graphics inside it. I have also tried creating a polygon feature, a feature set and a graphicsLayer as a container to hold all the selected graphics, but it didn't work. I am using ArcGIS Server 9.3 with JavaScript API. Please help. (Note: The code below has been extracted from a longer version. It might be missing some braces) function findPolygonsInExtent(extent) { var graphics = map.graphics.graphics; var attr =[]; var items = []; var graphic; var len=0; for (var i=0, il=graphics.length; i<il; i++) { graphic = graphics; if (extent.intersects(graphic.geometry)) { len = len + 1; var results = []; graphic.setSymbol(highlightSymbol); var featureAttributes = graphic.attributes; for (att in featureAttributes) { var s = featureAttributes[att]; results.push(s); } attr = results.slice(0,10); for(var j=0, jl=10; j<jl; j++) { items.push(attr ); } } //if else if (graphic.symbol == highlightSymbol) { graphic.setSymbol(symbol); } } //for map.setExtent(//some polygon feature//.geometry.getExtent()); } the utility function esri.graphicsExtent(graphics) returns the extent of graphics. It included in javascript api 1.6. So it should wok on ArcGIS server 9.3. If not, you just have to create a logic in you for loop for (var i=0, il=graphics.length; i<il; i++) to calculate an extent that contains all your graphics. let me know if you need more help on how.
... View more
02-23-2011
04:50 AM
|
0
|
0
|
2111
|
|
POST
|
Dear ArcGIS Javascript API Team, I have configured a secured MapService with a single layer (Picture Marker Symbol) using the proxy page from Esri. I have configured everything as told on the Javascript documentation about the proxy and if I use the mapservice as an ArcGISDynamicMapService it works fine and the proxy is triggered correctly. When I create a FeatureLayer pointing to the map service layer and add it to the map, I have realized that Internet Explorer 8 or 9 cannot show the images (Base64). The proxy page is being triggered and I believe is missing something in the response code. Google Chrome shows perfectly well all symbology. Can please someone provide me guidance on this? Cheers, José Sousa Try to change your image format before add your featurelayer somthing like yourFeatureLayer.setImageFormat("png24"). It might do the trick, please let me konw if it works.
... View more
02-23-2011
04:32 AM
|
0
|
0
|
2095
|
|
POST
|
Hi, I am creating graphics layer using esri.layers.GraphicsLayer. I need to display some key field value of that layer on graphics as label.Can i achieve using esri.symbol.TextSymbol? My code is like this : function ZoomshowResults(featureSet) { var zoomresultFeatures = featureSet.features; var ZoomGraphicsLayer= new esri.layers.GraphicsLayer({id:"1"}); var il; for (var i=0, il=zoomresultFeatures.length; i<il; i++) { var zoomgraphic = zoomresultFeatures; var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([72,61,139,0.35]), 1),new dojo.Color([72,61,139,0.35])); zoomgraphic.setSymbol(symbol); ZoomGraphicsLayer.add(zoomgraphic); } map.addLayer(ZoomGraphicsLayer); map.graphics.enableMouseEvents(); } Thanks in advance.. Sowmya Yes if you don't want to use InfoTemplate to display field value. However, you have to figure out a labeling point to display your text. There are a lot of ways to get the labeling point such as using geometry serivce's labelPoints method, using the centroid of the graphic's extend, or popluating x, y of the label point into your query layer and get them through graphic.attributes["X"]...
... View more
02-22-2011
05:35 AM
|
0
|
0
|
826
|
|
POST
|
I have the following code that loops through some JSON and draws points as graphics with infotemplates. Right now the default behavior is in effect, and clicking on a point shows the infowindow. I want to set this up so that if someone clicks on more than one point I use a different template, showing the list of links to features clicked on. The samples contain examples of this behaviour when using querytasks, but I'm not sure how to adapt that to my situation. Thanks! /* draw a set of sightings as points on the map */
function drawSightings(data) {
map.graphics.clear();
var point, colour, sighting;
//draw the points
for (var i=0; i < data.length; i++) {
sighting = data;
point = {"geometry":{"x": sighting.x,
"y": sighting.y,
"spatialReference": map.spatialReference},
"attributes":{
"number_observed": sighting.number_observed
},
"symbol":{
"color": [255, 0, 0, 128],
"size":12,
"angle":0,
"xoffset":0,
"yoffset":0,
"type":"esriSMS",
"style":"esriSMSCircle",
"outline":{
"color":[0,0,0,255],
"width":1,
"type":"esriSLS",
"style":"esriSLSSolid"
}
},
"infoTemplate":{
"title": " ${common_name} [${scientific_name}]",
"content": "Number seen: ${number_observed}"
}
};
graphic = new esri.Graphic(point);
map.graphics.add(graphic);
}
} Here is an idea: add a onclick event on map after you add custom graphics like: dojo.connect (map, "onclick", afterClick). In afterClick(evt) handler, buffer click point to a offset distance you defined (in order to creat a polyon instead of clickpoint itself). using this buffered clickpoint(thePolygon) to do a intersection analysis against the custom graphics like gsvc.intersect(esri.getGeometries(map.graphics.graphics), thePolygon.geometry, identifyCustomGraphics). In identifyCustomGraphics(geometries) handler, get the count of the geometries, if is more than one (meaning that your clicked and buffered point intersected with more than one custom graphics), then add the click point to the graphic layer with a template you specified. This could be a workaround for your situation. However it is little complicated and you have to consider the custom graphics info template's own click event are on etc...
... View more
02-21-2011
09:35 AM
|
0
|
0
|
1137
|
|
POST
|
OP is not using the extension for google maps but the code posted here: http://www.arcgis.com/home/item.html?id=a84d64b0d1404366a02da714ca59d61f nice to know. Thanks
... View more
02-18-2011
08:13 AM
|
0
|
0
|
2884
|
|
POST
|
I downloaded the src and examples to my box. The only change I made to the file is the following: I changed this: <script type="text/javascript" src="../src/gmapslayer_compiled.js"> to this: <script type="text/javascript" src="./gmapslayer_compiled.js"> as the gmapslayer_compiled.js is in the same dir as my .html file. The page loads fine but none of the google maps load. It's like my machine doesn't like the gmapslayer_compiled.js file to be local. If I load the URL of the example it loads fine, just not when I store it locally. What else could I be missing? @hzhu: I don't believe there is anything to download. I am using the Javascript API and I believe that google extension is already there, correct? Looking at that reference I see only how to use both Esri and Google at the same time, but they reference how to do so in JS, which is what I am trying to do but failing somehow. I have not done API for google map for year or two. So I might be wrong. API for google map is basically an extension of Google Map API. If you look at posted samples, ArcGIS layer is added on the Google map, not the opposite like the ArcGIS javascript API where Bing map is added to ESRI's map as a layer. However, using the Google map extension you can still do most of things that Javascript API can do. Plus somethings that Javascript API can not do like traffic, 3D etc (you can do streetview on any of the ESRI APIs through).
... View more
02-18-2011
04:22 AM
|
0
|
0
|
2884
|
|
POST
|
Hi, I'm referencing the following webpage: http://gmaps-utility-gis.googlecode.com/svn-history/r275/trunk/gmapslayer/docs/examples.html and trying to make a google map a layer. However I'm confused about the example. When i look at the source I see gmaplayers_compiled.js located at ../ I copied the gmapslayer_compiled.js file from code.google to my machine and reference it correctly, but this does not work. I even tried something VERY simple like this: <!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" /> <!--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>Google Test</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css"> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1"></script> <script type="text/javascript" src="./gmapslayer.js"></script> <script type="text/javascript" language="Javascript"> dojo.require("esri.tasks.query"); dojo.require("esri.map"); dojo.require("esri.layers.FeatureLayer"); function init() { var initExtent = new esri.geometry.Extent({ "xmin": -14628212, "ymin": 714227, "xmax": 7718305, "ymax": 9832858, "spatialReference": { "wkid": 102100 } }); map = new esri.Map("mapDiv", { extent: initExtent, logo: true }); var gMapLayer = new gmaps.GoogleMapsLayer(); // var gMapLayer = new gmaps.GoogleMapsLayer({visible:true, id:'googlemaps'}); map.addLayer(gMapLayer); gMapLayer.show(); } dojo.addOnLoad(init); </script> </head> <body> <div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div> <br /> <br /> <div id="info" style="padding:5px; margin:5px; background-color:#eee;"> </div> </body> </html> But it still doesn't work. I get no errors in the browser error console but I also get no map. What am I missing with this example/this concept? You have to use ArcGIS Extension for the Google Maps API in order to use google maps with ESRI's stuff. Go: http://help.arcgis.com/EN/webapi/javascript/gmaps/index.html for reference
... View more
02-17-2011
04:40 AM
|
0
|
0
|
2884
|
|
POST
|
Hi, I'm going back to basics and working with a sample. What i'm trying to do and failing is in the first instance is to deactivate the doBuffer function and only activate it when i clicking on a button. I'm using this esri sample http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jssamples_start.htm#jssamples/util_buffergraphic.html what i've tried and failed with is removing "dojo.connect(map, "onClick", doBuffer);" from the function initialize... gsvc = new esri.tasks.GeometryService("http://sampleserver1.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer"); dojo.connect(map, "onClick", doBuffer); adding in doBuffer.deactivate (); in the below funcation.... function doBuffer(evt) { doBuffer.deactivate (); map.graphics.clear(); var symbol = new esri.symbol.SimpleMarkerSymbol(); var graphic = new esri.Graphic(evt.mapPoint, symbol); then in the body adding in a button.... <button type="button" onClick="doBuffer.activate();">Click Me!</button> But its just not happening, where am i going wrong? Any help would be great Regards Simon Try this: put onclickConnect = dojo.connect(map, "onClick", doBuffer); in your button's onClick handler to activate the map click event. Then put this: dojo.disconnect(onclickConnect); in your doBuffer method to deactivate or dissconnect map click event. Note: set onclickConnect as a global variable.
... View more
02-17-2011
04:13 AM
|
0
|
0
|
1462
|
|
POST
|
Well, apparently what I wanted to do is not possible as the synchronous processing is not going to wait for the asynchronous relation to complete. What I did was to do some of the validation, then called relation. The relation callback checks the polygon and if good, then calls the rest of the validation. There has to be a better way to check for a valid polygon. Thanks anyway. Here are a couple of thoughts that might help: Enforce the validation of an input polygon using GeometryService's simplify method. It will make polygon topologically legal with regard to their geometry type (con is that it might slightly alter the shape of the original polygon). Or create GP serivce contains system tool -CheckGeometry_management, accepting input polygon as one of the input parameter and set output table as an output. If the output table contains no record, that means there is no problem associated with the input.
... View more
02-15-2011
10:49 AM
|
0
|
0
|
573
|
|
POST
|
I have a group of raster layers that are set under a group layer. The group layer is set to "EXCLUSIVE=TRUE" so that only one raster sublayer can display at any one time. Id's are : Parent layer 93 Sub layers 94, 95, 96 and 97 (94 is on by default in the map service) I want to switch the display to layer 97. I try to do this with the following code: imageParameters.layerIds = [29, 97]; imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_INCLUDE; var myMapLayer = new esri.layers.ArcGISDynamicMapServiceLayer "http://gsportenf/ArcGIS/rest/services/General_30/MapServer", {"imageParameters":imageParameters}); map.addLayer(myMapLayer); After running the code above, it still displays layer 94 instead of 97. Do I need to somehow disable the display of the parent layer or sublayer 94 before I can display layer 93 ? ps: I tried excluding all the unwanted layers first with imageParameters.layerIds = [93, 94, 95, 96]; imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_EXCLUDE (Made no difference.) Hoping someone can help. Have you tried using layerInfos. In layerInfos, you can identify sublayer by name, parentLayerId and/or subLayerIds. something like this: var infos = myMapLayer.layerInfos; //set the selected layer visible for (var i = 0; i < infos.length; i++) { if (infos.parentLayerId !=-1){ // a sublayer if (infos.name ==your raster layer name that you want to turn on) viewService.setVisibleLayers(); { } I have not testing the code. but should be something very colse...
... View more
02-15-2011
04:33 AM
|
0
|
0
|
345
|
|
POST
|
How do I turn of the tool tip for the add graphic? The one that says "Click to start drawing". I don´t want this text box and the other two following this one to show when my users start drawing. toolbar = new esri.toolbars.Draw(map, { showTooltips: false });
... View more
02-15-2011
03:58 AM
|
0
|
0
|
867
|
|
POST
|
Heming, OMG! You're freaking awesome. Not for only responding, but for responding with something that works! If you're gonna be at the Dev Summit next month find me, I own a drink. 🙂 Very glad it helps. I learned this trick from learning AJax and started realized that javascript is just as powerful as those OO language like C# or Java (encapsulation, inheritence, polymorphism).
... View more
02-15-2011
03:52 AM
|
0
|
0
|
686
|
|
POST
|
Alright everyone I just spent an hour on the phone with Tech Support and they're just as stumped as I am. I'm all v10. I have a Composite Locator wired up in my app. The "Parameters" are being submitted correctly and the "onAddressToLocationsComplete" fires off successfully, but no "candidates are being returned to the "app." I can run the geocoding service from the services directory and it returns candidates just fine. I've put my service in the ESRI sample and same thing, no candidates to the "app." I've done everything forwards and backwards with the ESRI sample and my app, still no dice... I can't get the candidates to "return" to the app, they're their...they'll return to the rest service in the services directory, but not to the app. No errors either. ??????????????????????????????????????? Any thoughts? Sometime is just the format of your location in locator.addressToLocations(location); Looking at your services directory's Address Fields. It listed the properties of location you have to specify. instead of using json expression, i found it is more safe to use javascript Object to specify location. Like the following: location = new Object(); location.Address =string; location.City =string; (Address, City... fields are different depend upon your loaction)... try this and let me know if it works nor not.
... View more
02-14-2011
09:10 AM
|
0
|
0
|
686
|
|
POST
|
add navToolbar.deactivate(); tb.activate(esri.toolbars.Draw.FREEHAND_POLYLINE); to your button's onclick eventhandler. Note: always activate one toolbar (draw or navigation) at a time not both!! set tb as a globle variable. in your code tb is a local variable...
... View more
02-14-2011
06:32 AM
|
0
|
0
|
1445
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-11-2011 12:16 PM | |
| 1 | 05-25-2017 08:26 AM | |
| 1 | 06-02-2017 07:37 AM | |
| 1 | 06-28-2011 07:02 AM | |
| 1 | 06-12-2017 10:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-01-2024
09:57 PM
|