Sunday, 20 November 2011

AutoCAD Starting Layer Script File

I have uploaded a small script file that I use for generating layers for mapping projects.

It is written in AutoCAD Metric format and you neet to type the SCR command in AutoCAD and browse to this file to execute it.

To construct this file, I worked in notepad and used a command structure like this (everything is supposed to be in one line):
-LAYER NEW LINE_CHAIN_FENCE LWeight 0.15 LINE_CHAIN_FENCE LTYPE FENCELINE1 LINE_CHAIN_FENCE

If you make your own, make sure to live a blank line at the end to exit the command input process.

Get it here:
http://www.box.com/files/0/f/0/1/f_1171015837#/files/0/f/0/1/f_1171015837

I'll upload some more when I get round to it.

Wednesday, 19 October 2011

GNSS Solutions Tutorial

This is a quick guide on Ashtech's GNSS Solutions version 3, a GPS, GLONASS and SBAS professional processing software.
It is quite simple to operate but keep in mind that you need to know the basics of GPS positioning theory before you can solve a network because there are not many ways of checking the achieved positional accuracy effectively so you have to rely on doing the GPS measurements and processing procedures 100% right. 

First up, in the GNSS Solutions install folder there is a MAIN.ini file. This file allows you to perform changes to some global settings used by all projects such as the "elevation cut-off angle". You may want to make a backup copy of it before tampering with its contents.
Right click on it, select "Open with..." and use a simple text editor like Windows Notepad. Make the changes necessary to your work and save the .ini file again with the same extension. 


In case you are working with a file format different to Rinex, GNSS Solutions is accompanied by Rinex Converter, a tool that allows you to convert your files. This may be opened either from inside the GNSS Solutions by going to Tools -> Rinex Converter from the menu bar or finding the executable file directly from the Start Menu.

In order to convert your files, you need to define the directory where your raw gps data is situated. To do this, click on the "Input dir" button.
Then you have to set the output directory where the converted data will be saved. Click on the "Output dir" button and browse to a folder.
It is strongly suggested that you do not use the "=" between the two buttons as using the same directory for both input and output may cause problems later on with organizing your files.



Now you may edit the metadata of the new files by clicking on the "Additional Info" button. There, you can edit information such as the observer name, antenna height and type or even the receiver's serial number. This is useful if you are following a set of standards for your Rinex files or you want everything in order. Information on antenna height and receiver type can also be changed later in the processing program but keep in mind that any changes you make in GNSS Solutions will not be written in the Rinex file.

You may edit additional conversion options such as "GPS", "GLONASS" or "SBAS" data to be included in the resulting file by clicking on the check boxes on the lower half of the window.
Select the files you want to convert from the left part of the screen (Shift+Click or Ctrl+Click to select multiple files) and press on the large, vertigal "BEGIN" button to begin the conversion. After it is done, press "OK" to continue.


With your Rinex files ready, open GNSS Solutions and click on "Create a new project" on the welcome screen. Alternatively, go to File -> New to start a new project.

On the next screen, name your project anyway you like in the "Project name" field and then press on the "Modify Default Settings" button. This is needed to set a series of very important parameters. If you decide to review them later on, go to Project -> Edit Settings from the menu bar.





 The "Region" tab allows you to set your Spatial Reference System, Time Zone and Linear Units. In case your coordinate system is not displayed, select the "New" option from the drop-down menu. You may also click on the "..." button to review your Datum parameters.


Choosing the "Precise Ephemeris" tab will give you the option of downloading Precise Orbit Files from an internet service if the positional accuracy you are aiming for requires it.


Finally, the "Miscellaneous tab" allows you to set horizontal and vertical desired accuracy and adjustment parameters. Modify them to better suit your project and click on the "OK" button.  


Now choose the way you want to import your files. If you are using stored Rinex files, press "Import Raw Data from Files or Promark/ProFlex devices" or press F4 on your keyboard. If you want to connect a compatible Magellan GPS receiver directly to your PC, GNSS Solutions can download the data for you if you select "Download Raw Data from Z-Max or ProMark3" or just press F3.


Browse to your Rinex files and select them. You will be taken to the "Importing GPS Data" screen. On the upper half labeled "Raw Data" you can review your Site codes, Antenna Height information, Height Type, Antenna Type and Receiver Type. Modify them to match your field notes and make sure everything is in order.

On the lower half labeled "Control Points" you have the option of choosing one of those points to act as a Control Point if you have its data. Edit the East, North and Height (ellipsoid or orthometric depending on your datum) and press the "OK" button and choose the "to import" subcommand to continue.

Your Logged Points and Control Points will now appear on a map. Points with common observation times will be connected with dotted red lines, a sign that the baseline has not been processed yet.
You will notice that the GNSS Solutions interface is split into 5 sections.
Toolbar: The standard windows menu bar containing all commands.
Workspace: Shortcuts to most of the commands found in the menu bar for ease of access.
Survey View and Time View: A graphical representation of your network and a representation of the observation times.
Workbook: Here you can see information on the raw data and baselines as well as processing and adjustment information once these procedures have been completed.
Output: All processes will be reported in this non-editable text box as they are executed. Watch it for errors.




If you want to review your observation times, click on the "Time View" tab below the map to switch to a graphic view.
Before continuing, you should go to Project -> Process Options to edit your processing settings. From here you may change the observation mode, delete baselines, exclude satellites or change the elevation mask angle. When you are done, click "OK" choosing the "To Save" subcommand.


Press F5 to process your baselines. If you have selected the option, GNSS Solutions will look for an active internet connection to download the precise ephemeris files now. 

After the processing has been completed, the baselines will turn a green color meaning that they are successfully solved and are within the horizontal and vertical accuracy limits set at the creation of the project. A solid red baseline means that the solution is over the accuracy.Right-click on the baseline and select "Properties" to investigate further. If you spot the error, change the Process Options and solve your network again, otherwise you may have to repeat your measurements. 

Notice the vertical line and black circle over midpoint of each baseline. The vertical line measures estimated vertical accuracy and the circles are horizontal error eclipses. You may compare them to the legend on the lower right part of the Survey View to see how well you did or you can see the process results directly in the Workbook below. 


Press F7 to adjust your network. This should be done only if you have have performed observations on a point from 2 different control points and thus you can use least squares adjustment. Notice that the error eclipses move on the points themselves to represent the adjustment. The adjustment results can be found in the Output panel or in the Workbook.


To finish your Project, press F9 to generate a text report on the baseline processing and the network adjustment by the name of "Land Survey Overview".









Saturday, 8 October 2011

Creating a GeoTiff image from WMS data

The problem with the previous solution is that you have to load the whole stream of image data in your drawing, making it consume your system memory and waiting for loading times.
In this example, we will use a GIS mapping software to export a georeferenced TIFF image file. The new file will contain projection data and will be ready to be inserted in a GIS or CAD drawing space. 
It is necessary to point out that you should not use GeoTIFFs by themselves for precision topographic design projects and they should be accompanied by on site triangulation measurements in order to validate their accuracy. They are intended as a complementary tool and should not replace geodetic measurements. Additionally, the date of aerial/satellite photography is important because the landscape tends to change with the passage of years as new construction projects are created or old ones are torn down.

I am going to use Global Mapper 12 (also known as dlgv32 Pro in the U.S.A.) in this example. Start the program and go to Tools -> Configure as seen below.


From the Configuration window that appears, select the Projection tab. Go to the field "Projection" and input the projection of the WMS data you are going to use. Following the previous post, I am going to use the  Greek Cadastre data so I need to input Greek Grid. Make sure to validate your Planar Units and Parameters before pressing the OK button to continue.


Back at the main screen, go to File -> Download Online Imagery/Topo/Terrain Maps.This will establish the WMS connection.


Now click on the "Add WMS Data Source" button if the WMS server you'd like to use is not already listed on the "Select Data Source" list.


 Enter the WMS server address in the Server URL field and then be sure to select the layer name from the list that appears below or else it will not be inserted. Press the OK button to continue.


The "Edit Online Source" window that appears allows you to categorize the data source you loaded for future reference. Press the OK button to continue.


Your data has been loaded and if you have set up the projection correctly, you will see a grid overlayed. Be sure to check the numbers to see if they match those of the grid you selected.


Zoom in to the area of interest. Your level of zoom does not matter, as long as you can see your area as the exporting of the GeoTIFF is independent and will be based on the size of the sampling pixel and not on your current screen display.Select the "Digitizer" button (looks like a pen) and then the Create Rectangular\Square Area option.


Click on your screen and drag the tool to create a rectangle. A "Modify Feature Info" window will appear and you will see some metadata that will be attached to the geographic feature you created such as name, area and perimeter. Enter a name and press the OK button to continue.


Now click on the "Select Feature Class" button to the left of the "Digitizer" and then click on the rectangle you created to select it. The properties of the feature will pop out.


Keep your selection active and go to File -> Export Raster/Image Format.


From the GeoTIFF Export Options go to "Sample Spacing/Scale" and set a value slightly less or equal to the pixel size of your WMS data. Be sure to tick on the "Generate TFW (World) File" and "Generate PRJ File" in order to create the georeference data that will allow you to import the GeoTIFF in another software.


Now choose the "Export Bounds" tab from the same window and choose the "Crop to Selected Area Feature(s)" option. This will crop the image to the boundaries of your rectangle and without it the whole WMS database may be exported. Press the OK button to continue.


You will be asked on a folder location to save your data in. Exporting may take some time and the size of the file created will greatly depend on the sampling size you chose.
To insert your GeoTIFF in Autocad Map or Raster Design, enter _IINSERT in the command line or choose the Insert button from the Raster Design ribbon. Browse for the GeoTIFF you saved and click OK.
The "Correlation source" should be "World File Correlation" and you should not tamper with the rest of the options as they are drawn directly from the .tfw file. Press twice on "Next" and once on "Finish" and then type ZOOM EXTENTS in the command line to see your georeferenced image. To unload or detach it, you should use the XREF command, right click on the file and choose your option.



Voila! Thanks for reading.

Wednesday, 5 October 2011

Connecting a WMS server to AutoCAD Map (the Greek Cadastre example)

For those of you not familiar with the subject, the entirety of Greece has been photographed by airplane during the years 2007 and 2008 on behalf of the Greek Cadastre (Εθνικό Κτηματολόγιο in greek). The resulting orthophotomaps are divided into Very Large Scale Orthomaps with pixel size in the scale of 20 cm (primarily covering urban areas) and Large Scale Orthomaps  with pixel size in the scale of 50 cm (which cover the rural areas and are the majority of the produced maps).
I have extensively worked on the quality checking of these images using GPS receivers during my time at the company SIMA S.A. and I can say that the resulting achieved horizontal accuracy is pretty high and can be used to complement the process of topographic mapping or urban/rural design on most cases.

The orthophotomaps are stored on a WMS server and can be inserted into AutoCAD Map as an overlay. To achieve this, you will need:
First of all, you must open your drawing and define the coordinate system by entering the ADESETCRDSYS command in the AutoCAD command line.The "Assign Global Coordinate System" window will appear and you should press the "Select Coordinate System" button. Then proceed to select the 1987 Greek Grid.

Selecting a coordinate system


Confirm your choice and return to the AutoCAD command line. Issue the MAPCONNECT command which activates the Data Connect module. This function as it allows you to connect databases and spatial databases to your drawing, especially useful if you are working on a large or complex project.
On the Data Connect screen, choose "Add WMS Connection" on the left and then proceed to fill in the blanks on the right. The "Connection name" field is not important but you should enter the WMS address given above in the "Server name or URL" field and choose 1.3.0. from the dropdown menu "Version". Press "Connect" when you are done.

The Data Connect window
.
Next, you will be prompted for a username and password. These are not important as the data is available to the public for free (for more information on this, please visit geodata.gov.gr, page in greek) so you should press "Login" to proceed.
On the next screen, make sure you click on the check-box next to "THE BASEMAP OF KTIMATOLOGIO" and that you validate the Map Coordinate System to avoid disastrous results. When you are done, click on "Add to Map" twice to connect the data. You should refrain from clicking again on "Add to Map" as it will make a new connection and load the data again, resulting in your RAM memory overloading with data. 
Notice the "Disconnect" button on the lower part of the dialogue box. You should keep it in mind In case you need to remove the connection from your drawing.

Finalizing the connection


Exit the Data Connect dialogue box and issue a ZOOM EXTENTS command in order to switch to an overview of the mosaic as it is transformed in the Universal Transverse Mercator projection. Zoom in to achieve better resolution and get to your area of interest. 

An orthophotomap of the city of Athens inserted in the workspace of AutoCAD Civil 3d 2011
  
You are done here.