How Can We Help?

Crunch a spreadsheet with Python

You are here:
< All Topics

Using the Cloud-RF API, you can process an entire spreadsheet of site data in one go to make a complete network coverage map.
This tutorial assumes you are a Windows or Mac user with minimal programming experience. It uses the free Python scripts available here.

Windows user? Don’t know Python?

Fear not, we have a script and tutorial for Windows spreadsheets processing here.

INSTALL PYTHON AND THE REQUESTS MODULE

Python is already present on a Mac but for Windows you need to install Python 2.7. Download the right package for your operating system from https://www.python.org/ftp/python/2.7/. You will also need the python requests module which you can install once python is installed with this command:
python.exe -m pip install requests

GET THE CLOUD-RF PYTHON SCRIPTS

Download the python scripts as a ZIP archive: https://github.com/Cloud-RF/CloudRF-API-clients/archive/master.zip.
.
The script we will use is called ‘calculate_and_mesh.py’ which uses several different API calls to process each row in a spreadsheet under a unique group name (network name), then it performs a mesh operation to merge the sites into a single coverage layer.

PREPARE YOUR SPREADSHEET

Your data needs to be in a basic comma separated CSV spreadsheet (known as MS-DOS CSV format in Microsoft Excel). The top row should be column headers defined at https://api.cloudrf.com. You can find an example CSV file called ‘demo_network.csv’ along with the python scripts.
Your UID and KEY values are unique to your CloudRF account and can be obtained once logged in at the ‘my balance’ page.

PROCESS YOUR DATA

Run the python script with one argument which is the name of CSV spreadsheet. You will see results appear in your terminal for each row. The final result will be the consolidated mesh. For the demo script and data, each run of the script will generate a new network name. This is necessary to stop you meshing lots of old files belonging to the same network when you might only want to mesh 10 new sites.
python calculate_and_mesh.py demo_network.csv

USE YOUR RESULTS

Everything you do is stored on the server. The demo script also pulls down a KMZ file for each calculation but if you want to see your finished result, login to the web interface at https://cloudrf.com/ui and open your archive. You will find your spreadsheet has become a coverage map.
You can use the data either in the web interface, download it from there as a KMZ, SHP or TIFF file. If you want to publish or share the data you can get a URL or HTML embed code to host the layer on your own website.

CHANGE AND REPEAT

Once you’ve got your result its quite common to wonder what effect a different parameter might have. To change a value for all columns, change it for the first row eg. set txw (Transmitter power in Watts) to 2 then copy that value into all the rows below. Save the CSV file and reprocess with the command as before. You will get a new network because the script uses a unique network name each time.
In your web archive you can then go and select the network with the old parameters and delete it by checking the box and clicking the trash can icon.

ALTERNATIVE LANGUAGES / SCRIPTS

The simple API can be used with any other language. You can find examples of Javascript forms from the API clients downloaded in the example above and more languages over at https://api.cloudrf.com. Expert users don’t even need a desktop as you can use CURL from a shell environment:

curl --request POST
--url https://cloudrf.com/API/area
--header 'Content-Type: application/x-www-form-urlencoded'
--data 'uid=21531&key=a8ec44b5ad85e0ab626e55f20e3cb5da111999a2&lat=50.355108&lon=-4.152938&txh=8&frq=868&rxh=2&dis=m&txw=0.1&aeg=2.14&rxg=2.14&pm=1&pe=1&res=30&rad=6&out=2&out=2&rxs=-95&ant=38&azi=0&cli=5&file=kmz&nam=DRAKES_ISLAND&net=DEVON&pol=v&red=-60&ter=15&tlt=0&vbw=0&col=10'

Table of Contents