Web AppBuilder and Javascript API - What to expect?

3030
4
12-14-2016 08:05 AM
DavidWendelken
Occasional Contributor

Let me explain what I want to do.  Then - I hope - I can get some guidance on whether this is possible using Web AppBuilder.


Here's my current code situation.   I'm hoping to integrate web app builder into it so that much of what I've already written won't be needed anymore.  That will streamline application maintenance at upgrade time.

1. This will be on a private network with no access to the esri website.
2. Currently, users can choose a base map or add a layer from any Esri arcgis webserver they can reach on the network.  
3. They can also add WMS layers from non-Esri gis webservers. 
4. The users can get a list of these basemaps or layers to choose from.

5. They can re-order the layers and alter the transparency or visibility.
6. They can print the map.
7. They can export the data from feature layers that are on the map without being limited to the number of records the underlying services are limited to serve in one call.


I tried using the iframe to display a portal map.  It displayed just fine but I could not find a reliable, maintainable way to send instructions to the map from the parent page.  My users use IE and apparently there's some "extra special" feature that blocks access from the parent.


So, what should be my path going forward?

Is there a way to use the iframe that (a) works and (b) isn't very fragile code?

Is there a way to reference the portal map from the javascript api so it brings across all the capability that shows up if I call the map via an iframe or direct via the portal?

Will using a Web AppBuilder map with the javascript api allow this?   Or would I have to build widgets to supply the missing functionality that the built-in widgets can't do?  Can custom widgets with Web AppBuilder be made to handle the functionality points 1-7 above?  The documentation I've found so far has been really short on details.  Would love a good solid reference to great docs or tutorials!

Thanks!


0 Kudos
4 Replies
DerekLaw
Esri Esteemed Contributor

Hi David,

I am not 100% clear on what you are trying to do, so I'll try my best to address some of your comments.

> Here's my current code situation. I'm hoping to integrate web app builder into it so that much of what I've already written won't be needed anymore.

Are you saying that you've developed a custom app with custom code and want to integrate/add Web AppBuilder's source code into it? I don't think this is the right approach. You're probably better off just using Web AppBuilder to create a new web app and then add your custom code to it.

> I tried using the iframe to display a portal map. It displayed just fine but I could not find a reliable, maintainable way to send instructions to the map from the parent page.  My users use IE and apparently there's some "extra special" feature that blocks access from the parent. ...

Not clear what you mean here. Do you mean a web map? And from Portal for ArcGIS or ArcGIS Online? Is your custom app trying to interact with the contents of the web map? Have you looked at the ArcGIS API for JavaScript documentation?

> Or would I have to build widgets to supply the missing functionality that the built-in widgets can't do?  Can custom widgets with Web AppBuilder be made to handle the functionality points 1-7 above?

Item 1: Web AppBuilder is designed to work with web maps from either ArcGIS Online or Portal for ArcGIS. You say that you will not have access to "the esri website" - will you have access to Portal for ArcGIS? When you create your app, you need to start with a web map, but you can access web services directly with the Add Data widget.

Items 2 - 6: These functional requirements are available in Web AppBuilder. Please review the help documentation,

Item 7: Your requirement is a little unclear, but the Analysis widget has Extract Data functionality. However, it requires access to either ArcGIS Online or Portal for ArcGIS with a hosting server configuration set-up.

FYI, some good documentation resources for Web AppBuilder:

Hope this helps,

DavidWendelken
Occasional Contributor

First of all, thank you very much for your thoughtful and useful reply!

>> Here's my current code situation. I'm hoping to integrate web app builder into it so that much of what I've already >>written won't be needed anymore.

 

>Are you saying that you've developed a custom app with custom code and want to integrate/add Web AppBuilder's

>source code into it? I don't think this is the right approach. You're probably better off just using Web AppBuilder to

>create a new web app and then add your custom code to it.

I have a web app that does a number of things.  The users set the context of what they want to work on in my app.  Some of the data that they want to see in my app is geospatial and some is not.  When they set the context in my app, the data on the map should reflect that same context.  So, when the user makes the context change, my app needs to be able to send the new filter information to the map and have the map respond by showing the new data.  (I don't want the users to have to change the data context in my app and in the map separately.)

In a previous app I made extensive use of the esri javascript api to manipulate maps integrated with other user actions.   So, I had to write code to add layers, hide layers, search thru web servers for esri web services they could add, print, etc.  I"m hoping to not have to write that portion of the code this time and piggyback on what comes in web appbuilder.

Hope that clarifies the overall need better.

>> I tried using the iframe to display a portal map. It displayed just fine but I could not find a reliable, maintainable way to

>>send instructions to the map from the parent page.  My users use IE and apparently there's some "extra special"

>>feature that blocks access from the parent. ...

 

>Not clear what you mean here. Do you mean a web map? And from Portal for ArcGIS or ArcGIS Online? Is your

>custom app trying to interact with the contents of the web map? Have you looked at the ArcGIS API for JavaScript
>
documentation?


We have an ArcGIS portal locally set up on our internal network.   We have no access to ArcGIS Online - if by that you mean the public internet site that Esri makes available.

Yes, my custom app needs to interact with the contents of the web map.  It needs to be able to, for example, apply a data filter to the various layers on the map.  I'm very familiar with the esri javascript api and know what to tell a map to do using that library.   I tried putting iframe with the src pointing to a map set up on our local ArcGIS portal into my app.   IE had some kind of "feature" that kept my application javascript from talking to the map in the iframe.   I googled around for a solution to this problem and didn't find anything I wanted to trust to work over time.  Would be happy to use this approach if I had a solution to that problem.

As a different approach, I added esri javascript api code to my app to sign into our local ArcGis portal and used esri.arcgis.utils.createMap command to access a map defined in our portal.  I assigned the resulting display of the map to a div in my application. Unlike the iframe approach, I could talk to the map just fine with my application code.  We added a bunch of widgets to show up in the map on the portal (and they did when we accessed the map via the iframe or via the portal user interface); but those widgets didn't show up when I accessed the map using the createMap function.   So, all the widgets in the portal map don't help me when accessing the map this way.  Ditto on happy to use this approach if I had a solution to that problem. 

Or some other approach.  I just don't want to invest a month into learning web appbuilder only to find out I can't integrate it into my app.

>Item 7: Your requirement is a little unclear, but the Analysis widget has Extract Data functionality.
Many of our feature layers have a maximum number of records set on the feature.  So, while there may be 10,000 records in the database the feature will only allow 3000 to come back.   When I wrote the extract data functionality in my last app, I had to query the webservice for just ids (which ignores that maximum number of records), then code the extract to make multiple requests for (in this example) 3000 records at a time and stitch them all together into one extract file.   So, in this case, would the Analysis Widget extract data functionality stop at 3000 or give me all 10000 records?

DerekLaw
Esri Esteemed Contributor

Hi David,

I'm not sure how to respond to your post as I am NOT a developer and I don't write JavaScript code. So you've developed your own app and your are familiar with the ArcGIS API for JavaScript - thanks for the clarification.

> I tried putting iframe with the src pointing to a map set up on our local ArcGIS portal into my app.   IE had some kind of "feature" that kept my application javascript from talking to the map in the iframe.   I googled around for a solution to this problem and didn't find anything I wanted to trust to work over time.  Would be happy to use this approach if I had a solution to that problem.

Sorry, but I can't help you with this item or the other issue you mention as I am not a developer. Suggest you post your specific developer questions in this forum,
ArcGIS API for JavaScript 

> So, in this case, would the Analysis Widget extract data functionality stop at 3000 or give me all 10000 records?

I would expect that the Analysis widget would honor the maximum record settings applied on the feature layer.

Hope this helps,

0 Kudos
TimHayes1
Occasional Contributor III

Sounds like a case for the Local Layer Widget. If you are using the Web AppBuilder Developer Edition, you will need to have at least one basemap accessed from ArcGIS Online (I chose the aerial basemap), but then can add as many of your own, hosted locally, as you want. Other than that, the Local Layer Widget allows 100% of your data to be hosted internally, private, locally.