FIFA World Cup 2018 Stadium Guide – Russia

FIFA World Cup 2018 Stadium Guide – Russia

The background story…

The motivation to create this story map series application is sourced from my true love for soccer (or as some like to call it, ‘football’).  I have always watched and loved soccer, and have a key interest for the English, Spanish, German, and South African leagues.

After following the 2017 FIFA Confederations Cup, which was hosted in Russia, I was interested in how the different host stadiums looked, and where they are located. This interest comes from my GIS (Geographical Information Systems) background – and now to fuse my two passions together, this was an exciting activity for me to complete.

Map soccer ball
How I like to see the world…

The goal…

The purpose of the ‘FIFA World Cup 2018 Stadium Guide’ application is for the public to be able to get thorough insights about each of the host stadiums, see how they look, obtain game fixtures, and explore each of the surrounding host stadium’s locations.

The method…

Firstly, I had to collect spatial and attribute information from the Internet, via various sources, to have enough of a foundation to create the source dataset, including the locations and information for each stadium.

The next step which I followed was to create customized (3D looking) stadium icons with Adobe Photoshop, as I wanted to include a picture of each stadium in the location markers for better effect.

Mordovia Stadium location marker icon
An example of the customized location marker icon for Mordovia Stadium

Once this process was complete, the stadium dataset had to be created, packaged, published to the web, hosted and ultimately be processed so that it could be used in the ‘FIFA World Cup 2018 Stadium Guide’ application.

I used a variety of Esri’s ArcGIS products to create this story map series application, namely:

ArcGIS Pro (Desktop)

This is where the file geodatabase, which included all the stadium locations and attribute data was created. Additionally, I created the 3D multipatches as well using ArcGIS Pro, for those stadiums which I could get existing 3D models. ArcGIS Pro was also used to create scene layer packages of the source data, which could be hosted in ArcGIS Online for the application.

Luzhniki Stadium 3D model
The 3D model used for the Luzhniki Stadium

 

 

 

 

 

 

 

 

 

ArcGIS Pro
Creating a scene layer package in ArcGIS Pro

ArcGIS Online

This is where I could use the hosted scene layer packages as input for web scenes, and then link these web scenes to the story map series template, to ultimately create the application. This application is hosted on ArcGIS Online.

Esri’s ArcGIS products give the user a great amount of flexibility, interoperability and a variety of configurations which can be altered to create a unique application. ArcGIS Online allows for the user to be able to host, author, and share one’s data, web maps, web scenes, and applications on the web.

The next step…

The future for this application would be to link it to a related application, depicting up-to-date progress, results, and news of the FIFA World Cup 2018.

You can access the FIFA World Cup 2018 Stadium Guide – Russia by clicking here.

Esri and the 3rd dimension

With Esri’s ever expanding software stack it is sometimes difficult to keep track of the variety of software solutions available. One of the main areas of growth is Esri’s collection is its answer to 3D GIS. Fully utilising the extra dimension has come difficult to the GIS sector in the past (which is historically mostly two-dimensional in terms of application). Esri’s recent focus on developing a 3D stack which fully embraces three-dimensional analysis, content generation and visualisation with the emphasis on sharing 3D scenes with non-technical users has led to mainly two desktop applications, ArcGIS Pro and CityEngine. This blog post will have a look at both of these applications by discussing the capabilities and when to use them through a typical use-case for an area around central Johannesburg.

Intro
CityEngine or ArcGIS Pro

ArcGIS Pro:

ArcGISPro

ArcGIS Pro allows users to seamlessly integrate traditional two-dimensional GIS with 3D data in a single application interface. Using the 3D Analyst extension a user can perform various 3D analysis on GIS data including line of sight, volumetric calculations, viewshed calculations as well as working with LAS datasets, as well as the traditional GIS analysis methods like proximity, overlay and statistical analysis. For more information regarding the 3D Analyst extension visit: http://www.esri.com/software/arcgis/extensions/3danalyst.

The image below shows a Johannesburg scene showing 3D textured buildings, analytical representation of trees and extruded polygons showing the various zones and height restrictions of the buildings. This gives the user the ability to quickly see which building exceed their height restrictions.

ArcGISPro001
Overlay 3D buildings and zonal restrictions in ArcGIS Pro

Next we need to calculate how the shadows in the city change over course of a specific day, and share the result with external users.

Use the Sun Shadow Volume geoprocessing tool (3D Analyst) to calculate the shadow volumes. In the example below the analysis were done between 08:00 and 16:00 for every two hours.

ArcGISPro002
Sun shadow volume tool

The resulting multipatch represents the shadow volumes created by each building at a specific time. ArcGIS Pro has the ability to cycle through these time-enabled data to create a seamless animation of the shadow movement.

Webp.net-gifmaker (1)
Shadow movement over the course of the day

Share the scene to either ArcGIS Online or Portal with ease. An example web scene for of the shadow analysis mentioned above can be viewed here.

*The next blog post will focus on the various 3D sharing techniques available in the ArcGIS Platform

ArcGIS Pro is a powerful tool for performing 3 dimensional analysis on GIS data. However, although ArcGIS Pro has 3D editing capabilities, its primary function is not 3D content creation. CityEngine on the other hand was designed especially for quick content generation on a large scale.

CityEngine:

CE

CityEngine’s ability to dynamically create and compare urban scenarios quickly makes it a favourite among urban developers, local governmental authorities, township planners as well as the entertainment industry.

The key behind CityEngine’s quick content generation is its own procedural scripting language called CGA. These scripts or rules are basically a set of sequential tasks that guides the software to create accurate 3D geometries.

By applying different rules to the same datasets, we are able to generate various 3D representations. In the example below, we can see that in the larger view a more realistic scenario is generated displaying textured buildings and highly detailed trees. The inserted image shows the same datasets represented differently to produce a more analytical scenario of the data.

2017-06-27 08-05-47 AM
Using CGA rules creates multiple scenarios quickly using the same data

In another example, an urban designer might want to compare scenarios for a redevelopment project. In the image below CityEngine is used to compare high rising buildings, office spaces and apartment building designs.

Webp.net-gifmaker
Comparing redevelopment strategies in CityEngine

A CityEninge scene can be easily shared in a variety of ways. These include:

A CityEngine webscene is a static version of the CityEngine scene. All models, terrains and networks generated in CityEngine is compressed into a single .3ws file. This file can then be added as an item in ArcGIS Online or Portal, and when opened creates a browser based 3D environment that allows user-driven navigation and interaction. An example of the CityEngine web scene can be found here.

The image above shows examples of:

  • comparing real-world and analytical scenes (top left)
  • comparing redevelopment scenarios (top right)
  • adding HTML embedded attributes such as Google Streetview (bottom)

Datasets can also be exported to a Scene layer package. A Scene layer package has the ability to publish hosted scene layers which represents 3D data as a feature service, when added to either ArcGIS Online or Portal.

CityEngine also has the ability to share a scene as a 360 Virtual Reality experience. This creates a .3vr file which can be shared to ArcGIS online. Using a Samsung Gear VR headset along with the ArcGIS 360 VR app from Esri Labs, you are able to explore scenes in a fully immersive 3D virtual reality.

Find the Johannesburg 360 virtual reality scene here.

VR

For more information about creating a 360 VR experience in CityEngine go to the Esri CityEngine Help.

CityEngine & ArcGIS Pro combine to show CCTV coverage in 3D

As part of our Modelling Reality in 3D series, this post looks at the Esri Africa User Conference demonstration of CCTV camera placement in 3D.

Modelling reality in 3D

A prominent United Nations study notes that the share of Africans living in urban areas is projected to grow from almost 40% in 2010 to over 60% by 2050. With the expected rate of population growth on the continent. This increase in urbanisation can lead to economic growth, transformation, and poverty reduction. However, without proper planning the possibility of increased inequality, urban poverty and associated crime exists.

One of the areas to address is crime and this needs to be done in a more systematic way. Applying geography will help us do that.

The aim of the demonstration was to show the location and coverage of CCTV cameras in downtown Johannesburg. The objective was to find the optimal coverage area in 3D by altering some of the camera attributes such as angle, direction and length. CityEngine was used to create the CCTV coverage rules, and ArcGIS Pro’s analysis abilities were utilised to determine the covered areas.

pic1

CityEngine:

Step 1 was to create a CityEngine rule that creates 3-dimensional shapes representing the visible area of each camera. The CGA rule is shown in the images below:

Attributes

pic2
Note that the Width and HorizontalRotation attributes derive their values by calling the getWidth and getRealDirection functions, respectively.
The getWidth function uses a Pythagorean algorithm to calculate the width (length of the opposite triangle side) by using the CameraAngle and ViewLength attributes.

The getRealDirection function converts the azimuth attribute (N= 0, E = 90, S = 180, W = 270) so that the coverage area has the correct real-world direction. See how altering these attributes effects the coverage areas in the video below.

 

Rules

The image below show the rules used to generate the viewing area:

  • Object: The Object rule uses the i-function to transform the CCTV point to an existing triangular Collada shape and then calls the Rotate rule.
  • Rotate: The rotate function uses the VerticalRotation and HorizontalRotation attributes to change the angle of the viewing area, before calling the Scale rule.
  • Scale: Finally the s function scales the viewing area according to the Width, VerticalHeight and ViewLength attributes. The rule then centres, colours and changes the transparency of the 3D viewing area.
pic3

ArcGIS Pro

The second part of the presentation showed how these CityEngine rules can be implemented in ArcGIS Pro for further analysis. Some of the analytical capabilities of ArcGIS Pro are listed below

  • Display the 3D view areas alongside existing 3D content (such as buildings) in ArcGIS Pro.

 

pro004
  • View feature information in a pop-up. This can include attributes, pictures, videos or HTML attributes such as an i-frame of the Google Street View.
pro001

 

  • Calculate the % of the area covered by the cameras. The image below shows the Before and After scenes after additional cameras (blue spheres) were added. We can analyse the coverage of the new additions and compare the calculated values to the previous scenario.
www.progif
By combining CityEngine with ArcGIS Pro we were not only able to realistically model reality, but also perform accurate 3D spatial analysis.

Modelling Reality in 3D with ArcGIS – Blog Series

modelling reality - logo

Welcome to 2016! This is going to be a bumper year on the Esri South Africa blog so be sure to keep checking back for new content (or you can subscribe using by clicking the FOLLOW US button on the right).

Following our successful demonstration of CCTV camera placement at the Africa User Conference, we are pleased to introduce a new blogging series that will showcase some new and innovative ideas for leveraging the power of 3D modelling and analysis within the ArcGIS Platform. The entries will be created by our team of 3D experts here at Esri South Africa and will include step by step guides on how to do it yourself.

If you have any specific requests for 3D modelling or analysis scenarios, please drop us a line using the comments below.

The first entry in the series, entitled “Determining Solar Potential for Rooftops using Multipatch Feature Types”, will be available next week!

– Richard

Migrating Python Scripts to ArcGIS Pro

What’s new?

MainImage

With the migration towards 64-bit processing in ArcGIS Pro, some big changes have come to the Python environment as well.

  1. Python in ArcGIS Pro has been upgraded to version 3.4. All other ArcGIS products are still using version 2.7. Both versions of Python are being developed in parallel and share much the same functionality.
  2. Changes have been made to the functionality within the arcpy site package. This includes the dropping of some functionality and the augmentation of others, e.g. arcpy.mapping has been replaced with arcpy.mp in ArcGIS Pro to support ArcGIS Pro’s mapping workflows. For a detailed overview of changes consult the following page.

Assessing the situation

ArcGIS Pro comes with a geoprocessing tool called Analyze Tools for Pro (Data Management Tools > General). This uses the Python utility 2to3 to identify issues when migrating a script and even goes so far as to identify functionality that has not been migrated to ArcGIS Pro. Running this tool will generate an output for you that will state which lines have errors and suggest appropriate changes which you can manually go through and assess. Often the required changes are small and can be make quickly without automation.

Converting your scripts

Sometimes a script is simply too big to go through manually. Thankfully Python 3 comes with a tool to help automate the conversion process.

NOTE: The following steps make changes to the input script. We recommend making a copy of the script being converted and appending 34 to the end of it and making changes to this version of your script so that you leave the original intact. E.g. script.py -> script34.py. If you choose not to do this, don’t worry, the script creates a copy of the file in the directory with a .bak extension to ensure the original script is preserved.

  1. Run Command Prompt as an Administrator
  2. Type in the following:

PythonInPro34

where C:\script34.py is the path to the script you want to convert

  1. Once done, the script should have most of the changes done required to make a script functional using Python 3 in ArcGIS Pro. We say most because some functionality within Python could potentially have moved, been renamed or replaced which would require manual intervention on your behalf where 2to3 utility could not make the required changes.

Writing scripts to work in both Python 2 and Python 3

The following tips will help greatly in ensuring a Python script will work in both ArcMap and ArcGIS Pro as long as the tools referenced in the script are available in the ArcGIS Pro version of arcpy. By making these practices a habit when scripting in the Python 2 environment, you will greatly ease the transition into the world of Python 3.

  • Tip 1:

Adding the following line to the top of your script will import some of the new rules enforced in Python 3 to your Python 2 script:

PythonInPro34_2

print_function

The print statement has been replaced with the print function. This function is also available in Python 2 and by using it you ensure your scripts will work in both environments.

PythonInPro34_4.png

 division

Python 3 handles division of integers in a more natural line of thinking. This is one of my favourite new things as it makes things far less confusing for people just starting out with Python.

Python 2: 3/2 = 1
Python 3: 3/2 = 1.5

If you find you need to use the old truncating division, you can simply use ‘//’ instead of ‘/’.

 absolute_import

The behavior in Python 3 means that by default top level imports are honoured. Lower level imports need to be explicitly stated. This relates to complex scripts referencing other scripts and for the most part will not affect the majority of users. For more on the implications of this click here.

unicode_literals

String literals are unicode on Python 3 and making them unicode on Python 2 leads to more consistency of your string types across the two runtimes. This can make it easier to understand and debug your code!

Basically “Some string” in Python 3 is now equivalent to u”Some string” in Python 2.

If you want to use 8-bit strings like the default in Python 2, simply place a ‘b’ in front of it and you’re good to go.

  • Tip 2:

Import known modules with changes in the following fashion to ensure that the required functionality will be available within your script:

PythonInPro34_3

Cheat sheet to changes in Python 3

  • Adding the following line at the top of your script will enforce encoding within your script in Python 3 as it’s parsed to utf-8: PythonInPro34_5

You no longer have to cast to string in Python 3 – anything within quotation marks will explicitly be treated as an encoded string of the document’s encoding type!

  • Exceptions are no longer iterable, you are required to use the exception attribute args to print messages:

PythonInPro34_6

  • int and long types have been merged. Before, one could simply write 5L and the 5 would be a long integer, now this will give you a syntax error. If you explicitly need to set a long integer the following approach is required:

PythonInPro34_7

One of the foundations of the ArcGIS Platform is the concept of extensibility – the ability to allow users to extend the functionality of the software beyond it’s out-of-the box processing capabilities to suit the required workflow. The Python scripting language lends itself very effectively to this end. Using some of the tips outlined in this post you’ll be well on your way towards producing adaptable Python scripts that speak to the needs of users within multiple environments.

Happy scripting!