Integrating ArcGIS Server, SQL Server, JavaScript API and Python/ArcPy

1789
4
01-03-2017 08:29 AM
LloydBronn
Occasional Contributor II

I've been creating web maps from services hosted on our ArcGIS server using the JavaScript API. My company wants to expand the capabilities of our website. We produce daily and weekly weather analysis reports (charts and PowerPoint PDFs) for weather stations, lat/lon points, and for countries and regions. We currently produce these reports from Python scripts that query our SQL databases and create Excel charts and/or PowerPoint presentations. These scripts incorporate ArcPy tools and models. The reports and charts are then attached to points or polygons in ArcMap and published as map services on our server. This is all automated, but it happens behind the scenes. We would like our clients to have the ability to create these reports dynamically from the website. For example, the user enters lat/lon coordinates or a location, or clicks on a country, and a report is generated on the fly.

I've created SQL db connections in ArcMap and registered these databases on the ArcGIS server. I'm not sure how to take the next steps. Should I use PHP within my HTML/JavaScript documents to call our Python scripts that access the databases and create reports? I've seen examples of query layers on the JavaScript API reference, but I can't find any example workflows for what I'm trying to do.

0 Kudos
4 Replies
Rudy_Stricklan
New Contributor III

I know this isn't the kind of answer that you are looking for, but something to be aware of in offering for-fee services using ArcGIS Server is prohibited unless you have a "Commercial ASP Use License" (as referred to in the 9/22/2016 version of the Esri License and Services Agreement, section 2.2:

a.     Customer may:

.....

6. Use server Software for Commercial ASP Use if Customer has procured a Commercial ASP Use license or is a governmental or not-for-profit organization that operates a website or offers an Internet service on a cost-recovery basis and not for profit.

The reason I'm painfully aware of this is that I have a client who was offering for-fee PDF reports from a ArcGIS Server-hosted Web Application Builder application, without the requisite ArcGIS $$$erver Commercial ASP Use License, and had to do some backtracking. Granted, it's rare to be detected but the point is that you can use ArcGIS software internally to make money for your company, but you can't offer to rent it out, as it were. Just a word of caution in your enterprise. If I'm jumping in unadvisedly, I apologize.

Having said all that, it is straightforward to create a WAB that produces formatted reports from a geoprocessing script.

0 Kudos
LloydBronn
Occasional Contributor II

Hi Rudy,

This is not something we will be selling at first. I said clients, but the end users will be part of our organization for the time being. Down the road we will offer these products publicly and we will make sure that we have the proper licenses. 

Just to clarify, this won't be a WAB as we don't have an AGS account. This is strictly ArcGIS Server with JavaScript API maps. 

I'm trying to figure out how to run external Python and Visual Basic scripts from a click event in a map service. The Python script extracts raster data using ArcPy and converts it to csv. A VB script then creates a chart from this csv data in Excel. I know that this can be done with PHP, but I'm unsure of how to integrate this process in the map.

0 Kudos
Rudy_Stricklan
New Contributor III

Good clarification, Lloyd, thanks. Regarding your question about calling

Python scripts from a map service, check out this GIS StackExchange link:

http://gis.stackexchange.com/questions/137206/how-to-run-a-python-script-on-the-server-returning-the-results-to-the-client

Rudy

LloydBronn
Occasional Contributor II

Thanks Rudy. I should probably jump over to the JavaScript API forum from here on out. 

0 Kudos