|
POST
|
It might just be the use of arcgisUtils.createMap since it will will accept either a webmap id or a JSON of a webmap spec esri | API Reference | ArcGIS API for JavaScript This is also a handy way of defining your renderers via WebMap spec in JSON for use in your application. I have a WebMap spec editor in use for clients right now that works like this and it comes in real handy. Odd though, as I would expect the the basemap and operationalLayers would need to be in an itemData object, so maybe they did add some internal checks to do that little bit. Either way, very cool catch for Web App Builder users.
... View more
08-13-2014
08:17 AM
|
0
|
0
|
4530
|
|
POST
|
Using a Promise such as dojo/Deferred will probably be the most reliable to accomplish close to what you are asking. The main sticking point is that you are delegating the responsibility of waiting for the map to load to the createScalebar methods, which is an asynchronous process. The Scalebar widget will internally already wait for the map to load, so there is really isn't a need for you to do it also in this case. What the Scalebar does not do at the moment unfortunately is emit a load event. Someone mentioned in a thread somewhere that in a future release, all widgets will emit load events. If you leave out the waiting for the map to load, your original code works fine. With widgets, when you writing your own and they are dependent on the map, then you should be concerned about waiting for the map to load, similar to how this esri dijit for the geocoder works on github. If you really need to wait for the load of the map in that create method, I think a Promise is a good way to do it.
function buildScalebar(opts) {
var def = new Deferred();
var _map = opts.map;
var anchor = ('anchor' in opts) ? opts.anchor : "bottom-left";
var unit = ('unit' in opts) ? opts.unit : "dual";
_map.on('load', function() {
var sb = new Scalebar({
map: _map,
attachTo: anchor,
scalebarUnit: unit
});
def.resolve(sb)
}, def.reject);
return def.promise;
}
buildScalebar({
map: map
}).then(function(scalebar) {
scalebar.hide();
scalebar.show();
});
Hope that helps a bit.
... View more
08-07-2014
07:37 AM
|
0
|
1
|
3851
|
|
POST
|
Here is a sample that shows how to display popup information inside a sidepanel.
... View more
08-07-2014
06:35 AM
|
1
|
0
|
1139
|
|
POST
|
Instead of waiting for the load event, you may want to try adding both layers with the map.addLayers method and waiting for the layers-add-result event. So something like:
map.on('layers-add-result', doMaps);
map.addLayers([layer1, layer2]);
If you look at the docs for the load event, it fires when the first basemap is added to the map, so there is no guarantee that those layer1 and layer2 services are ready when doMaps fires using the load event. It may work, it may not, but it's worth a shot. It looks like you are also using the addLayers in the doMaps method, which you don't really need to, but it would be good practice to use on.once to launch that method only once, so you could do:
on.once(map, 'layers-add-result', doMaps);
If not, you'll probably run into an endless loop since doMaps will fire the event again and launch again, and again, and again, ha.
... View more
07-30-2014
08:03 AM
|
2
|
0
|
4393
|
|
POST
|
I'm almost out the door, so can't test at the moment, but if you remove the template you set in the constructors for your GraphicsLayers and use the map.infoWindow methods to manually populate the infoWindow, I think you'll get the desired behavior. The infoWindow templates on the graphicslayer would override the manual method and since they are not linked they won't do the toggle via next feature you are looking for. It will probably just the Popup for the topmost feature of the overlapping layers. Depending on how much control you need over when the popup is shown and you really need to keep them in separate layers you could adjust the workflow slightly. No template for GraphicsLayers Listen for click event of map Get graphics from multiple graphicslayers that intersect click point Dynamically generate the content and add templates to graphics Use map.infoWindow methods to add features to Popup Display Popup Unless the graphics are on the same layer, I don't think you could automate it much easier. Here is a sample that uses the map.infoWindow.setFeatures method similar to how I was trying to describe it Feature layer with popup | ArcGIS API for JavaScript
... View more
07-16-2014
11:00 AM
|
1
|
1
|
2699
|
|
POST
|
If you use the map.infoWindow.setFeatures([n1,n2,...]) that should cycle the graphics in the popup. Can you post the code you're using to display the popups?
... View more
07-16-2014
10:31 AM
|
1
|
3
|
2699
|
|
POST
|
You can add the features to the maps infoWindow which is an instance of the Popup popup-amd | API Reference | ArcGIS API for JavaScript So you could take your graphics and do something like
map.infoWindow.setFeatures([graphic1, graphic2]); // pass it an array of your graphics
map.infoWindow.show(e.mapPoint); // assuming this occurs after a maps click event
Be sure to use map.infoWindow.clearFeatures() every time you need to reset it. Here is a section from docs on working with Popups Info windows and graphics | Guide | ArcGIS API for JavaScript
... View more
07-16-2014
10:12 AM
|
2
|
5
|
2699
|
|
POST
|
There are a couple of projects out there that tackle this very thing. A populat choice is the ConfigurableViewer, where everything can be setup viewer a JavaScript file. It's pretty easy to jump into and there's a lot of good info in the issues discussions. A project I put out that is incredibly flexible and uses lazy loading of widgets is this esri-js-starterkit. It's designed so that every feature of your application can essentially be built as a widget, even the map. Everything is configured via a JSON file, even the WebMapSpec which lets you use an AGO webid or you can replicate the WebMapSpec to include your own services. Here are a few widgets provided on github. odoe/esri-map-widget · GitHub odoe/esri-simpleedit-widget · GitHub odoe/esri-touch-widget · GitHub
... View more
07-14-2014
06:42 AM
|
4
|
3
|
2490
|
|
POST
|
You might be able to do something like this.
var graphicNode = graphic.getNode();
on(graphicNode, 'click', function() {/*stuff*/});
I haven't tested that, but worth a shot.
... View more
07-10-2014
06:39 AM
|
0
|
0
|
1087
|
|
BLOG
|
I made a similar blog post not too long ago, but thought I might share this here. Clustering of point data is a pretty neat way of being able to deal with displaying large amounts of data on a map in a simple way. This capability is a staple in the Flex and Silverlight Esri APIs, but the JS API has not gotten the same sort of love. The Esri Solution The Esri solution is a neat little module used in this sample you can download and customize as needed. This works pretty nicely and I have seen it used in quite a few apps that Esri puts out. It's not part of the core API, mainly because the use cases can differ so much as to what someone wants to do with it. It doesn't link directly to a map service, as it requires you to provide it a data source of coordinates and customize the behavior from there. Which works pretty well if you are dealing with spreadsheets of data that has x/y locations associated with it, ala GPS data. But I needed something a little more flexible (in my opinion) that could take my existing FeatureServices or regular Dynamic Map Services and act more like a FeatureLayer. So I did what any good dev would do. I stole their stuff and tweaked it. The ClusterFeatureLayer With the ClusterLayer code in hand, I started chipping away at the innards, taking out stuff I didn't need and Frankensteining together features I did need. It started simply enough, rigging it to take in a FeatureService URL or a MapService URL and using that as the source for the point data. That wasn't too hard, although it was a little slow. So I took (stole) some stuff the FeatureLayer where I would load the data via multiple requests using objectids1000 at a time and cache the data. Then I added options to either download all the data at once or as needed, ala MODE_SNAPSHOT in the FeatureLayer module. The Beast You can view the project on github here. There are some details in the README and more details in the comments to the code. There has already been a few contributions to the code, which is the beauty of github. You can view a demo of basic clustering here. Did I also mention that it will accept services with polygon geometries and convert them to points and cluster them for you? Yeah, it can do that too. Pleas feel free to log issues or contributes. I'm currently testing out some options to try and speed up some bottlenecks and generally refactor the code.
... View more
07-08-2014
09:02 AM
|
2
|
3
|
2624
|
|
POST
|
They showed some 3d capabilities with the ArcGIS JS API at Dev Summit earlier this year. I think it was slated for 4.0, but things can change. I would imagine there will be some demos at UC.
... View more
07-02-2014
07:06 AM
|
0
|
0
|
1682
|
|
POST
|
Since FloatingPane is part of dojox, it may not be an Evented module yet. You could go back to using dojo/connect or I think the preferred way to handle these modules is using dojo/aspect http://dojotoolkit.org/reference-guide/1.10/dojo/aspect.html aspect.after(floatingPane, 'onHide', handlerFunction);
... View more
06-20-2014
01:44 PM
|
0
|
0
|
2109
|
|
POST
|
I haven't tried this, but here is the css for the esri logo copied straight from Chrome dev tools .map .logo-med {
display: inline-block;
vertical-align: bottom;
width: 65px;
height: 36px;
z-index: 30;
background-image: url("../images/map/logo-med.png");
cursor: pointer;
_background-image: none;
} So you might be able to override those manually in your own css by using the !important tag each rule. Worth a shot.
... View more
06-20-2014
10:34 AM
|
0
|
0
|
2288
|
|
POST
|
I append a div to the "map_root" element. The name can vary based on the map id, so it's technically MAP_ID_root. For that div, I have css set up like this.
.my-logo {
display: inline-block;
position: absolute;
height: 36px;
width: 46px;
right: 5px;
bottom: 5px;
z-index: 30;
background-image: url('../img/my-logo.png');
cursor: pointer;
}
That works for me.
... View more
06-20-2014
09:50 AM
|
0
|
0
|
2288
|
|
POST
|
It sounds like you might want to try dojo/on#pausable http://dojotoolkit.org/reference-guide/1.10/dojo/on.html#pausable Here is from a post a while ago http://forums.arcgis.com/threads/98389-Cancel-Identify-Task?p=353584&viewfull=1#post353584 It also looks like you are trying to toggle what function happens on the map click based on a certain state in your application. I wrote something up for that recently that might be useful. https://gist.github.com/odoe/7e6b13cfac66e5cc99a5 You can basically use it like this var handler = on.switchable(map, 'click', function1, function2); //defaults to function1 first
...//do stuff
handler.toggle(); // now will launch function2 when event occurs
...//do more stuff
handler.toggle(); // returns to using function1 to handle events
... View more
06-19-2014
12:25 PM
|
0
|
0
|
2109
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Wednesday | |
| 2 | 05-19-2026 02:12 PM | |
| 1 | 04-24-2026 11:01 AM | |
| 2 | 04-21-2026 07:06 AM | |
| 1 | 02-27-2026 06:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|