Now that you know how to grab or download an image from a WMS server, and how to create a World File for it, the next step is to create an XML file which can be used as a Raster in InfraWorks.
This XML file will be used as a connection to retrieve an image from a WMS server. As soon as it completes the download of the image from the WMS server it will store this in the InfraWorks (SQLite) model. Now every time you reconfigure this Raster feature in InfraWorks it will reconnect to the WMS server using this XML file.
The XML file is built of a format known as GDAL WMS. The complete format is explained over here. We are going to use the same parameters as we have used in our example in our post How to grab aerial image maps from WMS server.
To read the URL easier and to compare it with the GDAL WMS format the parameters are shown below in several rules.
Note that the BBOX coordinates are setup from LowerLeftXY to UpperRightXY.
The above URL translated into a GDAL WMS XML format looks like this:
Note that the DataWindow coordinates are setup from UpperLeftXY to LowerRightXY. A common mistake is when the BBOX coordinates are used as the DataWindow coordinates, which will surely result in an error when configuring the XML in InfraWorks.
Click here to download the wms.xml file.
Now use this XML file as a Raster feature in Infraworks and configure it. The aerial image map will be retrieved from the WMS server right into InfraWorks.
Happy Web Map Service! :-)
In continuing effort of my last blog post, I will explain how you can create a simple world file to use with an image which is not georeferenced to use with AutoCAD MAP, Civil 3D and/or InfraWorks.
In my previous blog post “How to grab aerial images from WMS server” you have made a rectangle (or square) as the boundary to your project of where you want to download an aerial image from a WMS server.
Now I will use the same example to write down the coordinates of the upper left corner of that rectangle (or square). Now use the half of the value of the factor I have calculated back then (which is in fact the ground resolution of that particular image) and add this value to the X ordinate, and subtract the same value from the Y ordinate. The result will be used as the coordinates for the World File which in return will be used as the insertion point of the aerial image map.
Now create a text file with the following content (6 rules):
X (value = UpperLeft X ordinate plus half the value of the calculated factor)
Y (value = UpperLeft Y ordinate minus half the value of the calculated factor)
If I use the same URL example from my previous blog,
the content of my World File will be as follows:
Save the file with the same name as the image you have downloaded from the WMS server but with the file extension built as follows:
If your image has the jpg file extension, use jgw as the file extension for the World File. You can name any bitmap file extension by omitting the 2nd (or middle) character and by shifting the 3rd (or last) character to the left and finally by adding the ‘w’ character to the end. So ecw would become eww and png would become pgw, etc.
You can also download the file here.
Now you can use both files, the downloaded aerial image with the self made World File in AutoCAD Map / Civil 3D or InfraWorks. You may even use these files in vanilla AutoCAD if you like, by using this free available tool: GeoRefInsert from the Autodesk Exchange Apps store.
In my next blog post I will explain how you can successfully use a GDAL WMS XML file to use with InfraWorks.
Happy georeferencing! 😃
With AutoCAD Map 3D or AutoCAD Civil 3D (planning and Analysis workspace) you can connect to a WMS data server via the MAPCONNECT command. Once connected you can select a Layer or layers from the available presented list of layers, choose the coordinate system corresponding to the one you have set in your drawing and add the data to your drawing. If everything runs well your window screen will be filled with all the layer data from the selected WMS server. Aerial Imagery maps can be served this way. Once you’ve connected and add aerial images to your map, your window will fill with aerial images. But you will not recoginize much detail. But by zooming in, much more detail will become available until a maximum value is reached. This maximum value is explained as ground resolution and stands for the image content expressed in a distance in units per pixel image. For example: 0.5m/pixel or 50cm per pixel. The smaller the units expressed in cm or m (or inches/feet) the better the quality of the image.
However, you can not grab the image directly in AutoCAD Map 3D or Civil 3D to use as a standalone or as an attached image. For this you could make a printscreen of your AutoCAD Window. But the resolution is as ‘good’ as your resolution of your screen. You could also use the re-sample function from the MapWorkspace to download the active screen to a temporary folder on disk. In both cases the retrieved imagery is not georeferenced and therefor hard to insert at the right coordinates back into the drawing.
Another and much better way is, to use the EXPORTMAPTODWG function, which will allow you to create a new DWG with the image attached to that DWG. But only the image of what you visual have zoomed into at that moment will be captured, created and attached. This way you have the retrieved image positioned at the right coordinates in the drawing. But the image resolution is as good as the resolution from screen.
There is an alternative way to do both: get a better image resolution and have the image georeferenced. How to grab an aerial image map from a WMS server, right after the jump. Grabbing an aerial image map from a WMS server can be done via a web browser by using a typical URL with special parameters which the WMS server understands for retrieving the requested data from the server. But before you built this URL, you need to know which required parameters the wms server is using. This can be done by using the GetCapabilities request first. An example is given below:
This will return an XML file which can be opened in any text or XML editor.
In the next section I will explain which of the parameters can be used to built the GetMap request URL. The GetMap request URL can have or should contain the following parameters:
- Built the URL starting with the same WMS url you have used with the MAPCONNECT function in Map 3D or Civil 3D. Mostly it ends with a ? mark or & mark. What follows next does not have to be in a certain order. I.e http://geodata1.nationaalgeoregister.nl/luchtfoto/wms?
- Place the version=x.x.x phrase into the to be built URL. To know which version the wms server is using, request it by using the GetCapabilities first. I.e http://geodata1.nationaalgeoregister.nl/luchtfoto/wms?version=1.1.1
- Place the REQUEST=GetMap phrase into the to be build URL like in the example below. Add the & character in front of the phrase. I.e. http://geodata1.nationaalgeoregister.nl/luchtfoto/wms?version=1.1.1&request=GetMap
- Place the LAYERS=layer name<,layer name> phrase. Add the & character in front of it. Use the same layer name(s) you have used in Map 3D/Civil 3D when connecting and adding the layer(s) to your Map. The right layer name(s) can be different than the display name(s) Map/Civil 3D will show you. If you want the exact layer name(s), make use of the GetCapabilities request in an Internet browser before you continue. From that response you can filter out the right layer name(s). I.e. http://geodata1.nationaalgeoregister.nl/luchtfoto/wms?version=1.1.1&request=GetMap&layers=luchtfoto
- Determine the geographical or Projected coordinate system expressed as a EPSG code and place it into the URL as follows: SRS=EPSG:code or CRS=EPSG:code. Use CRS for 1.3 versions only. Replace the : character in the url with %3A. The required epsg code can also be found by using the GetCapabilities request first. I.e. http://geodata1.nationaalgeoregister.nl/luchtfoto/wms?version=1.1.1&request=GetMap&layers=luchtfoto&SRS=EPSG%3A28992
- Place the BBOX=LowerLeftX,LowerLeftY,UpperRightX,UpperRightY in the URL. And add the & character at the start. Define a window in Map3D/Cvil3D and determine the lower left and upper right coordinates. Draw a rectangle for example and write down the upper left and lower right coordinates. These coordinates will be used in the boundingbox (BBOX) part of the URL. I.e. http://geodata1.nationaalgeoregister.nl/luchtfoto/wms?version=1.1.1&request=GetMap&layers=luchtfoto&SRS=EPSG%3A28992&BBOX=208670.623,375465.3687,209670.623,375965.3687
- Place the FORMAT=image/jpeg phrase in the URL but replace the / with %2F so it will show image%2Fjpeg in the URL. Add the & character at the end. I.e. http://geodata1.nationaalgeoregister.nl/luchtfoto/wms?version=1.1.1&request=GetMap&layers=luchtfoto&SRS=EPSG%3A28992&BBOX=208670.623,375465.3687,209670.623,375965.3687&FORMAT=image%2Fjpeg
- Use the maximum allowed WIDTH and HEIGHT of the image grabbed from the WMS server. This could be different for every WMS server. Most of the times I found, sometimes by trial and error or sometimes by using the GetCapabilities request, the value of 2000 or 2048.
- Now here comes the trick: calculate the width and height values of your rectangle to the maximum WIDTH/HEIGHT so the width and height are in relation to each other. For instance: your largest side (width) of the rectangle is 1000m. Then your WIDTH value will be the maximum WIDTH of 2000. It needs a scale factor of 0.5 to get the 2000 into 1000m. Your shortest side (height) is 500m. Then your HEIGHT will be 1000 by using the same scale factor of 0.5. If you have drawn a rectangle with equal width and height, a square, you can use the same value for the maximum WIDTH/HEIGHT of the WMS server. This scale factor is also important for creating a World File later. I.e. http://geodata1.nationaalgeoregister.nl/luchtfoto/wms?version=1.1.1&request=GetMap&layers=luchtfoto&SRS=EPSG%3A28992&BBOX=208670.623,375465.3687,209670.623,375965.3687&FORMAT=image%2Fjpeg&WIDTH=2000&HEIGHT=1000
So the complete URL example of a WMS server GetMap request could look like this: http://geodata1.nationaalgeoregister.nl/luchtfoto/wms?LAYERS=luchtfoto&FORMAT=image%2Fjpeg&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A28992&BBOX=208670.623,375465.3687,209670.623,375965.3687&WIDTH=2000&HEIGHT=1000
Applying the GetMap request URL into any webbrowser will result in showing the image within the given boundingbox. The below image is just for reference and will not have the same resolution as the image when you click the above URL. Rightclick the image applied from the above URL and save it to your harddrive or network share. You now have the image ready to be used in AutoCAD. But you are not there yet. This image example isn’t georeferenced. If the WMS server supports GeoTiff images, only then the saved image is geo referenced.
In my next post I will explain how to create a World File for non GeoTiff images like above example. Without using an application or add-on which can create World Files from images like Raster Design does.
Great news. At least for the mobile AutoCAD WS users.
AutoCAD WS, for the iPad at least, now supports Civil 3D drawings, and it works great.
When you open an AutoCAD Civil 3D drawing in the AutoCAD WS app you will see the drawing in one of the 3 available Views: 2D, 3D Wireframe and 3D Solid. You can easily switch to either one of those Views.
If you have a Surface in the drawing, the 3D Solid View will show you the solids of the triangulation of the surface. Just like you would see when you make use of the Object Viewer by selecting the Surface within AutoCAD Civil 3D.
Switching to 2D View will show you the drawing in Plan View.
Switching to 3D Wireframe View will show you the drawing in 3D View showing Civil 3D objects like Feature Lines and probably more objects as I first have to test this more.
See: AutoCAD WS
See also below images made from my iPhone:
This video will show you how you can import a LandXML file containing a DTM surface into vanilla Microstation V8i (SELECTseries 3).
Yeah, I know. It has nothing to do with AutoCAD Civil 3D itself, besides that Civil 3D can export (and of course also import) LandXML files. So when you have a contractor or client or other project team using Microstation V8i (SELECTseries 3) you could share your Civil 3D TIN surface through LandXML export.
I really like this adoption of the LandXML DTM/TIN feature with Bentley’s flagship Microstation because it has all the functionality to change the style of the Surface and annotate it where needed in the drawing. You can not though change or alter the TIN surface in anyway. But in most cases you don’t need to alter the TIN surface when you are in a phase of the project when you need to create construction drawings and the existing or proposed ground surface does not change at all anymore.
I really would like to see this functionality in vanilla AutoCAD too.
Go see and check it out: Import LandXML into MicroStation V8i (SELECTsereis 3) and Annotate – Terrain Model (via Twitter: @EnvisionCAD and @Blip)
Here’s a quick remedy for the following error:
In AutoCAD Civil 3D 2012, when I want to insert a subassembly from the Toolpallette or Content Browser, I get this error:
I did not know what caused this error. But repairing or even re-installing the application did not solve the issue. At least for me it didn’t. I couldn’t find any solution from the Autodesk support website so I made a support request at Autodesk Subscription Tech Support. They replied: re-install the application. Well that didn’t work.
So I was delivered to the resources of the internet community. And that’s not bad as you may read right after the jump.
Out there on the web I read that it had something to do with the way you’ve made the installation, through manual installation or through network deployment. Working as a CAD application administrator I always use deployments because of the many installations we need to make. Looking further on the internet, I even found a blog page describing the same error and the solution for an AutoCAD MEP installation. Read here for their findings. Their solution was that within the User’s roaming Support\RegisteredTools folder I should have had the appropriate files in it.
So I made a manual (stand-alone) installation on another system and compared that with the network deployment. With the manual installation under the User’s roaming Support\RegisteredTools folder I found the right files in it as described before with the AutoCAD MEP installation. Where the network deployment installation did not had these files under the User’s roaming Support\RegisteredTools folder.
The location for Windows 7 or Vista is:
“C:\Users\<user account>\Roaming\App data\Autodesk\C3D 2012\enu\Support\RegisteredTools”.
So I’ve copied those files from the manual installation location to the network deployment installation location, started AutoCAD Civil 3D 2012, and there you go. Inserting subassemblies from the ToolPalette or even from the Content Browser did not gave me the “Unable to execute the tool” error anymore.
You can download these 3 .atc files here.