July 2022 — Technical note #72
How many people have looked at the location of their model and found that it has been plotted in the middle of the Atlantic Ocean? The problem is your coordinate reference system (CRS). It is a common issue amongst all modelers and GIS practitioners alike – how to set the CRS correctly. If your model is in the wrong place, the solution is very rarely a manual transformation but getting the coordinate reference system correct. This should be done at the start of any project.
What is a coordinate reference system (CRS)?
A coordinate reference system is a way of turning positions on the globe (3D) into positions on a map. It essentially provides a way of projecting the 3D positions onto a 2D surface as we have in a map or our computer screen. You can think of it as a method for trying to wrap a piece of paper around the globe as either a circle, cone, or cylinder.
All CRS have some level of inaccuracy in either preserving distances, angles, and the areas of the objects in the maps. Therefore, different CRSs are used for different applications and for different locations across the world. The aim is to give the most accurate projection with the least distortion for the application you need to use it for in the location that you need to use it for. This is why moving a model or data source manually should be avoided as a change of coordinate system is never a simple translation and rotation.
The CRS may be given in different formats. The most common are EPSG, WKT or Proj. Aimsun Next supports all three formats. Each of these formats will include information on:
Additional parameters may be set. The EPSG code combines this information into one number. More information on common CRS can be found at https://spatialreference.org/.
How to set the correct CRS at the start of an Aimsun Next project?
A common question is, “How can I translate my model from the Atlantic Ocean to the correct position?”. Whilst instinctively this seems like an easy operation, it is very rarely the correct solution. This is because when you translate a model a large distance, it will appear distorted as the locations are not reprojected to the right CRS. Instead, you should look to get the CRS correct at the start of your project.
The best way to do this is to select the location when creating a new model file using the map at the bottom of the window. Then select “Set Area”. This will set an appropriate CRS using the UTM zone for the location given.
How to check the location?
It is essential after you have opened your new file or you have received a model from someone else, that you check the location is correct. This means that you can take advantage of importing geolocated objects such as public transit data from GTFS feeds, background mapping and other GIS based data sources. It also gives you the ability to export results for display in other mapping softwares. Fixing a wrong choice of CRS afterwards may require reimporting everything from scratch, so it’s something that should be checked as early as possible.
To check the location of an Aimsun Next model, zoom in on a junction in Aimsun next. Then go to Tools > Show Location in Google Maps. This will take you to the equivalent location in Google Maps. You should see the same junction, not just the same rough location, as CRSs can sometimes differ by just a few metres. If Google Maps is not showing the correct location or is showing a map that is not oriented like your model, you have a problem with the CRS.
You can also check the validity of data sources by importing into an external mapping software such as QGIS and comparing against a trusted background source such as open street map.
How to change the CRS of an existing model
CAUTION: Caution should be taken when changing the CRS of an existing model. If a model or layer has become distorted at some point through being imported with an incorrect CRS, then this function will not work as the model will retain the distortion.
Whilst it is recommended that you get the location of your model correct at the start, that isn’t always possible. If you get a model from someone else and you find things aren’t aligning, you can change the CRS of your model in Aimsun Next. To do this, go to Project > Properties and change the WKT or EPSG string to the correct CRS. When you press okay, the x and y coordinates of every point of the model will be interpreted according to the new projection. You should then check if this has fixed the location using the Show in Google Maps tool.
Note that, unlike in a GIS software, changing the project CRS doesn’t perform a reprojection, i.e. it doesn’t change the x,y of the points, it just sets a different way to interpret those x and y values. A reprojection is only performed when importing new data to convert the positions in the external file (which can be degrees, feet, or meters with another CRS) to the CRS set in the project. This implies that if any layers were imported with an incorrect CRS setting the positions have been distorted and you cannot fix this by just changing the project CRS: the only solution is reimporting the file. Therefore, the first time you import an external file, you should check that the x and y of your objects align with data with a known projection e.g. check against a CAD tile that uses British National Grid if your model is in the UK. In lack of other data sources, you can always import the area from Open Street Map as a background just to perform this check.
How to find the correct CRS
If it still does not go to the correct location or additional layers do not match up, either the project CRS or the CRS selected during the import are not correct. But it is not always easy to find the correct CRS if one is not provided as is common in CAD files. A good starting point would be to search which CRSs are used for the area of your project in https://epsg.org/home.html, and pick the one whose x,y values resemble more the ones in your file.
How to import secondary layers
When you import another layer into Aimsun Next from a different data source, it may be in a different CRS to that of the project. If it is not reprojected to the CRS of the project, it will not align correctly.
To solve this, Aimsun Next uses on the fly reprojection. When you import a layer, you will be prompted to choose which CRS the file uses. If it’s not the same as the one set in the project, a second dialogue offers the possibility to choose whether to reproject the file to the CRS of the project, or to import the file without reprojection and set the CRS of the file as the CRS of the project. The first option is generally the one to choose. The second option is useful only if you haven’t created or imported anything into the model and you haven’t set the right project CRS yet, as it doesn’t reproject to the new CRS the objects that are already in the model.
However, when you are importing CAD files you have a slightly different dialogue as they don’t include a description of the CRS used within the file itself. Therefore, you have to find the correct projection and declare it in the box when prompted.