|
POST
|
An alternative way is to use geometryService.project to reproject the extent in non-Web Mercator to Web Mercator, and use the result to zoom the map to in the callback function.
... View more
08-14-2013
07:15 AM
|
1
|
0
|
1896
|
|
POST
|
Try this. Change: featureLayerFL.setVisibility(true); featureLayerFloodSlider.value=0.5; map.graphics.refresh(); To: featureLayerFloodSlider.set("value", 0.5); featureLayerFL.setOpacity(0.5); featureLayerFL.setVisibility(true);
... View more
08-14-2013
07:11 AM
|
0
|
0
|
450
|
|
POST
|
var extGraphics = GraphicsUtils.graphicsExtent(map.graphics.graphics); Check extGraphics value after executing the above line. If the value is not what you expected, check map.graphics.graphics to see how many graphics there. To be safe, I would use featureSet to get the graphics array.
... View more
08-13-2013
11:06 AM
|
1
|
0
|
1440
|
|
POST
|
Several thoughts about your code. 1. Seems like all the feature layers are from the same map service. If so, why load the whole map service instead of creating feature layer for each which is very expensive. Unless you want more controls to each layer, I would load the map service instead. In the map service, you can group the layers into group layers, and still control the layer visibility using the checkboxes you created via layer.setVisibleLayers(). 2. I would use layer.hide() to turn off a layer instead of removing it from the map. 3. In the legend constructor, you haven't defined the layerInfos. Since the API does not provide a way to update the layerInfos, all the layers (feature layers, basemap layer and any other layers) must be loaded first before creating the legend.
... View more
08-13-2013
06:38 AM
|
0
|
0
|
1292
|
|
POST
|
Try to use var legend = new esri.dijit.Legend({ map : map, layerInfos: [{layer: legendLayer1}, {layer: legendLayer2},...] }, "legendDiv"); where legendLayer1, legendLayer2, ... are the layers you like to display in the legend. If it does not work either, it is not hard to develop a custom one using REST api. Good luck!
... View more
08-12-2013
07:01 AM
|
0
|
0
|
1292
|
|
POST
|
I don't believe ESRI JS API provides a way to add labels for graphics. Currently you can only add labels for feature layers published along with the map services.
... View more
08-09-2013
08:21 AM
|
0
|
0
|
635
|
|
POST
|
infoTemplate is not used to set the label, but to set the content of infoWindow when clicking on the features.
... View more
08-09-2013
06:32 AM
|
0
|
0
|
635
|
|
POST
|
Not clear what you like to accomplish by reading your code. Do you like to query the TaxDistrict layer first, and then using the returned TaxDistrict features to query against Streams layer using spatial touch or spatial intersect? There are some issues with your code: 1. Since there will be two queries and one will be performed after another, two functions will be needed, one to perform the first query; the other is the callback function of the first query, and will perform the second query. 2. You haven't defined the callback function for queryTaxDistrictsTask. Here is the workflow I would have if you like to query TaxDistricts first, and the Streams layer the second based on the TaxDistricts query result. function queryTaxDistrictsFunc() { county = document.getElementById("countyField").value; taxDistrict = document.getElementById("taxDistrict").value; var queryTaxDistrictsTask = new esri.tasks.QueryTask("url of the TaxDistricts layer"); var queryTaxDistricts = new esri.tasks.Query(); queryTaxDistricts.returnGeometry = true; queryTaxDistricts.outFields = ["DNAME", "CNAME"]; queryTaxDistricts.where = "CNAME = '" + county + "' and DNAME = '" + taxDistrict + "'"; queryTaxDistrictsTask.execute(queryTaxDistricts, callbackTaxDistrictsQuery); } function callbackTaxDistrictsQuery(featureSet) { firstGraphic = featureSet.features[0]; var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new dojo.Color([100,100,100]), 3), new dojo.Color([255,0,0,0.20])); firstGraphic.setSymbol(symbol); firstGraphic.setInfoTemplate(infoTemplate); map.graphics.add(firstGraphic); var queryStreamsTask = new esri.tasks.QueryTask("url of the Streams layer"); query.geometry = firstGraphic.geometry; query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_TOUCHES; queryStreamsTask.execute(query, callbackStreamsQuery); } function callbackStreamsQuery(featureSet) { // do what ever you like to handle the Streams result here }
... View more
08-08-2013
06:53 AM
|
0
|
0
|
893
|
|
POST
|
Sample code: var pt = new esri.geometry.Point(x,y,map.spatialReference) var pms = new new esri.symbols.PictureMarkerSymbol('/images/pin.png'); var attr = {"Xcoord":evt.mapPoint.x,"Ycoord":evt.mapPoint.y,"Plant":"Mesa Mint"}; var infoTemplate = new InfoTemplate("Vernal Pool Locations","Latitude: ${Ycoord} <br/> Longitude: ${Xcoord} <br/> Plant Name:${Plant}"); var graphic = new Graphic(pt,pms,attr,infoTemplate); map.graphics.add(graphic) where attr will be the attributes of the feature, and anything inside ${} is one of the field names in attr. I normally like to create a separate graphics layer so not to pollute map.graphics, and you will have more control over the graphics added. Hope it helps.
... View more
08-08-2013
06:30 AM
|
0
|
0
|
609
|
|
POST
|
Which PrintMap tool are you using? I've used the PrintTask, and it works with esri base maps which are tiled map services.
... View more
08-07-2013
03:13 PM
|
0
|
0
|
419
|
|
POST
|
The whole idea should work. Since there are some code missing, it's hard to tell if the code works. What went wrong with your code?
... View more
08-07-2013
03:10 PM
|
0
|
0
|
893
|
|
POST
|
var extGraphics = esri.graphicsExtent(inGraphics); map.setExtent(extGraphics) where inGraphics is the array of the graphics you like to zoom to. Hope this helps.
... View more
08-07-2013
03:00 PM
|
1
|
0
|
1440
|
|
POST
|
ESRI should provide an easy way to allow display all the fields in the popup template, like if fieldInfos not provided, all the fields will be displayed. Anyway, before ESRI has a solution, we have to come up with one ourselves. Here is the one I am using. The whole idea is to request the layer info first. Then populate fieldInfos with the layer fields returned. This way, you need to hard code the fields for each layer. Hope it helps. var layerUrl = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/TaxParcelQuery/MapServer/0"; var layerInfoRequest = esri.request({ url: layerUrl, content: { f: "json" }, handleAs: "json", callbackParamName: "callback" }); layerInfoRequest.then(function(response) { var fieldInfos = array.map(response.fields, function(aField) { return { fieldName: aField.name, label: aField.alias, visible: true }; }); infoTemplate = new esri.dijit.PopupTemplate({ title: response.name, fieldInfos: fieldInfos }); console.log("Success: ", response.layers); }, function(error) { console.log("Error: ", error.message); });
... View more
07-26-2013
08:05 AM
|
0
|
0
|
3231
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-17-2013 05:16 AM | |
| 1 | 11-06-2013 04:34 AM | |
| 1 | 08-29-2013 10:58 AM | |
| 6 | 10-20-2020 02:09 PM | |
| 1 | 11-20-2013 06:09 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-17-2024
08:41 AM
|