|
POST
|
If I add the featureLayer in after adding the dynamicMapServiceLayer it works fine and I get no error. if I try to add the featurelayer first I get a "type error" I think the map is taking on the properties (such as extent and coordinate system) of the Dynamic layer, which then allows you to add the Feature Layer. See the Dynamic Map help entry which says: "If the first layer added to the map is an ArcGISDynamicMapServiceLayer, the map will take on the projection of this layer." You could try specifying these properties when you declare the Map object:
//specify the initial extent and coordinate system
var initExtent = new esri.geometry.Extent({"xmin":-9270392,"ymin":5247043,"xmax":-9269914,"ymax":5247401,"spatialReference":{"wkid":102100}});
//create map
map = new esri.Map("mapDiv",{extent:initExtent});
This should allow you to add the Feature layer to the map without first requiring the Dynamic layer. What am I doing wrong and why will the featureLayer not show up under the dynamicMapServiceLayer? A Feature layer is a type of Graphics layer, and according the help file, "Graphics layers can be reordered within the group of graphics layers. However, the graphics layer in Map.Graphics is always on top. Also, all graphics layers are always on top of TiledMapServiceLayers and DynamicMapServiceLayers." So you may need to change the way you're adding these layers, and either use two Feature layers, or two Dynamic layers. Steve
... View more
01-22-2012
01:41 PM
|
3
|
0
|
2507
|
|
POST
|
There might also be terms of service issues with what you're doing Derek's correct - the Google Maps API documentation says: Note: the Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions. If you want an address search like Google's, you can try writing your own code to wrap around the ArcGIS geocoder. Eg, work out which parts of the entered string are the number, road name, road type, and suburb, then run a geocoding query using those parameters. Here is an example script showing one possible approach to parsing the address to determine its components. You would then feed this information into a geocoding operation, knowing which section was the street name, etc. Steve
... View more
01-18-2012
05:36 PM
|
0
|
0
|
1326
|
|
POST
|
I really don't want the whole nav bar; I have my own nav bar which works for my application and just want to add this one function. Is there a way to do this without the nav bar? See the toolbar sample code page (sorry, I should have linked to this earlier) which shows the buttons inside Divs:
<bodyclass="claro">
<divid="navToolbar"data-dojo-type="dijit.Toolbar">
<divdata-dojo-type="dijit.form.Button"id="zoomin"data-dojo-props="iconClass:'zoominIcon', onClick:function( {navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN);}">Zoom In</div>
<!-- <divdata-dojo-type="dijit.form.Button"id="zoomout"data-dojo-props="iconClass:'zoomoutIcon', onClick:function(){navToolbar.activate(esri.toolbars.Navigation.ZOOM_OUT);}">Zoom Out</div>-->
I haven't tested this, but it should be possible remove the buttons you don't want, and/or put the Zoom In button on your existing Nav bar. Does that help? Cheers, Steve
... View more
01-12-2012
02:11 PM
|
0
|
0
|
1146
|
|
POST
|
Thanks, this works:
basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
map.addLayer(basemap);
dojo.connect(basemap, "onLoad", function() {
alert(basemap.fullExtent.xmin);
});
... View more
01-11-2012
03:11 PM
|
0
|
0
|
785
|
|
POST
|
Take an example of a Map Service in the REST API. This contains an Initial Extent and Full Extent: Intial Extent: XMin: -207.682974279982 YMin: -40.6075371681153 XMax: -37.1804225764967 YMax: 129.89501453537 Spatial Reference: 4269 When creating a new Tiled or Dynamic layer from this service, the Initial Extent and Full Extent are listed as null in FireBug. How can these values be obtained programmatically? Feature Layer contains a fullExtent property but I can't see the equivalent for Dynamic or Tiled layers. The goal is to zoom to the extent of the layer once it's been added. Thanks, Steve
... View more
01-11-2012
02:51 PM
|
0
|
2
|
1203
|
|
POST
|
As far as I can see, there isn't a removeLayers() option (to remove an array of layers) on the map object. Instead, there is a removeLayer() option (to remove a single layer). So you could iterate through each layer on the map to find the correct layer. You can iterate through all of the tiled/dynamic layers using map.layerIds and through all of the feature layers using map.graphicsLayerIds. Once you'd found the correct layer, you can remove it using map.removeLayer(layer) Steve
... View more
01-11-2012
02:02 PM
|
0
|
0
|
683
|
|
POST
|
So I've decided to eliminate the state dropdown and replace it with a zoom box button (probably a magnifying glass or something similar). When the user clicks on this button, I want it to result in a one-time zoom via the zoom box. See the Navigation Toolbar sample to enable the Zoom Box functionality. To have this work as a one-time operation, you could cancel/deactivate the tool after each use, if required. Steve
... View more
01-11-2012
01:56 PM
|
0
|
0
|
1146
|
|
POST
|
Do you know if there is a sample like this that has the ability to select multiple features by drawing a rectangle on the map? I don't know of any samples, but it should be possible. IdentifyParameters allows you to specify the geometry - you should be able to use a rectangle drawn by the user. Good luck, Steve
... View more
01-11-2012
01:50 PM
|
0
|
0
|
1892
|
|
POST
|
Cool, glad you got it sorted. The first sample was pretty dodgy - it loaded the map then immediately ran the query, which isn't very useful. In case anyone reads this thread later, attached is a more useable version. It waits for the user to enter a query string, then runs the query when the user hits the Query button. If you step through it in FireBug you can see what's happening. Cheers, Steve
... View more
01-11-2012
01:27 PM
|
0
|
0
|
2284
|
|
POST
|
Matt, This sounds promising. Do you have any samples (either your own, or can you point to someone else's online) which show how to do this? Steve
... View more
01-11-2012
12:20 PM
|
0
|
0
|
1145
|
|
POST
|
when I hide the feature layer the dojo.connect function is no longer available so I don't have to disconnect it. Either that or I'm propagating memory leaks ; ) That's a question for someone from Esri I guess. I'd say that if you're running code to hide the layer, it's no big deal to switch off the listener at the same time, so you might as well.... Can I use arrays to streamline the code (obviously using more than one feature layer), like the following: dojo.connect(wfLayers, "onMouseOver", function(evt) { As before, I think you'll need to run a for each loop and set this for each layer individually - there's no mechanism to set the onMouseOver listener directly on an array of layers, to my knowledge. Cheers, Steve
... View more
01-10-2012
07:09 PM
|
0
|
0
|
1154
|
|
POST
|
I would like a URL something like this "http://myarc.server.com/map?StateName=Texas" In the above example the map would open and then zoom in to the state with the Name = Texas. Take a look at location.href to obtain the URL, then parse it to obtain the section you need, before feeding that to the search/query section of your code. Steve
... View more
01-10-2012
02:14 PM
|
0
|
0
|
753
|
|
POST
|
Derek Swingley from the JS team posted a sample at http://jsfiddle.net/swingley/wKue4/ which should give you a head-start.
... View more
01-10-2012
02:06 PM
|
0
|
0
|
1892
|
|
POST
|
I know this is basic but this topic might be a good Dev. Summit or U.C. seminar session. On the contrary, I think it's an excellent suggestion and would definitely make a good Dev Summit session. The ArcGIS.com samples (lower-left of the Samples page) might be a good place to start. The Border and Margin sample says: In the sample application the CSS and JavaScript are inlined in the page to make it easier to view the code. However in the real world the CSS and JavaScript are typically contained in external files. Click here to download a zipped version of the sample which uses external files for the JavaScript and CSS. This gives a good indication of separating the HTML, CSS and JS components. Steve
... View more
01-10-2012
01:38 PM
|
0
|
0
|
1145
|
|
POST
|
You know how I said I hadn't actually tested that code? There were a couple of typos in there. The showResults section should look something like this:
function showResults(results) {
var result = results.features[0];
var extent = result.geometry.getExtent().expand(5.0);
map.setExtent(esri.geometry.geographicToWebMercator(extent));
}
The key missing thing was results.features[0], to obtain the first feature in the results. You may also need to translate the extent from geographic coordinates to web mercator, depending on your datasets (as in the attached demo, which zooms to the extent of a polygon on opening. That's because the query uses a dataset specified in decimal degrees, while the basemap is in Web Mercator.) Cheers, Steve
... View more
01-09-2012
05:21 PM
|
0
|
0
|
2284
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-17-2014 08:45 PM | |
| 1 | 03-15-2011 04:23 PM | |
| 1 | 10-18-2019 12:50 AM | |
| 3 | 01-22-2019 02:33 PM | |
| 1 | 09-26-2011 10:36 PM |
| Online Status |
Offline
|
| Date Last Visited |
10-20-2022
12:19 AM
|