Thursday, January 31, 2008
How to Add the Date and the time to an ArcGIS layout
http://arcscripts.esri.com/scripts.asp?eLang=&eProd=28&perPage=10&eQuery=date
Most professionals make sure that this filename is on every drawing. One thing you should note: the time stamp that this program produces is not dynamic. ie. it is just static text.... it will not update automatically. If you come back to the drawing 3 weeks later, it will still have the old date and filepath. You need to use the button everytime you publish/print your ArcGIS mxd document.
Option 2: If you are ready to dive right in to VBA (alt+f11)
Option Explicit
Private WithEvents m_pActiveViewEvents As Map
Private Function MxDocument_BeforeCloseDocument() As Boolean
UnSetEvents
End Function
Private Function MxDocument_OpenDocument() As Boolean
SetEvents
End Function
Public Sub SetEvents()
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Set m_pActiveViewEvents = pMxDoc.PageLayout
End Sub
Public Sub UnSetEvents()
Set m_pActiveViewEvents = Nothing
End Sub
' add time and by whom map printed
' date/time changes when layout refreshed -- you usually have to actually refresh it yourself to get the time to change correctly
' add a textbox that says something like pTextElement.Text below
Private Sub m_pActiveViewEvents_ViewRefreshed(ByVal pView As IActiveView, _
ByVal phase As esriViewDrawPhase, _
ByVal data As Variant, _
ByVal Envelope As IEnvelope)
Dim pGC As IGraphicsContainer
Set pGC = pView
pGC.Reset
Dim pElement As IElement
Set pElement = pGC.Next
Do While Not pElement Is Nothing
If TypeOf pElement Is ITextElement Then
Dim pTextElement As ITextElement
Set pTextElement = pElement
If Mid(pTextElement.Text, 1, 8) = "Printed:" Then ' look for the textelement to be refreshed
pTextElement.Text = "Printed: " & Format(Time, "h:nn AM/PM") & " on " & Format(Date, "mm/dd/yyyy") & " by Chuck Norris" '& _
'vbNewLine & put whatever else you want here on a new line - uncomment line continuer on above line at end too ...
End If
End If
Set pElement = pGC.Next
Loop
End Sub
Other Tags: Adding date/time to MXD documents, Adding filenames to MXD documents, making a button to add date/time to ArcGIS
Wednesday, January 30, 2008
Changing the Colors in an xref without modifying the External Reference - an AutoCAD guide
Method 1)
-Insert the xref into the document
-open the layers property manager
-click select all... layers or press Ctrl+a (or select as many layers whos colours you want to change)
-select a colour
Keep in mind that Method 1 is the easy way, it will not work unless the layers in the xref have colour "by layer" selected. There is no way to change the colour in an xref in this situation without altering the original external reference file.
Method 2) Breaks all the rules
-open the xref as a seperate document
-select everything in the model space
-in the color selection drop down menu choose "by layer"
- now you should be able to xref into your document and use Method 1 to change the colours of the layers
Method 3) Colours STILL won't change
- the only time colors still will not change in the xref is when they are locked into a custom
block in the xreference
- the ONLY way to fix this is to edit the blocks individually in the xref document, i'm afraid.
You can repeat these same methods for altering lineweight, line type and any other property features posses in AutoCAD.
I have heard rumor that sopmeone has written some code that can do these tasks/bypass them. If anyone has heard anything, please, please let me know.
With this guide, I have hopefully helped you to override xref colors. Overriding xrefs can be very annoying!
Monday, January 28, 2008
Ripping and Georectifying Google Earth Images into ArcGIS
Methodology
1. Place 3 or more placemarks at the edge of the portion of the Google Earth image you wish to move to ArcGIS
2. Save each of them in Google Earth (they can be found listed in the My Places folder).
3. Import the points to ArcGIS with ET Geowizards
You can find a more detailed article about importing and exporting to/from Google EArth to ArcGIS
here : exporting from GE
and
here : importing GE points into ArcGIS 9.2
One you have added each of your points as a point feature in ArcGIS, you now need to import the Google Earth Image itself. The only way to do this - that I currently know of - is the following:
- Turn off all layers in Google EArth so you just see the satellite image/air photo
- press alt+print screen to dump your screen's image to the clipboard
- paste the image into a paint/image program
-save the image as an ESRI compatible format (be sure to leave the Google Earth Copyright information on the image as well as the company who provided the data to Google).
- Add the image into ArcMAP
Once you have the image in ArcMAP, it does not have any coordinates. In this situation you need to georectify it to fit the 3+ points you recorded earlier in GE. If you do not know how to georectify an image, be sure to follow my guide at:
ArcGIS Tutorial: Labelling contours effectively
Here is the methodology :
Go to the layers property menu for your contour Shapefile in ArcMAP. For the test string label select your zvalue attribute (z value is the cartesian coordinate for elevation/altitude). This layer may not be named in the same way as you see in the image below. But it will most likely carry a name such as Z value, elev, elevation etc... This is the attribute you want the line to show . eg. 250 meters
For the symbol select brown and a sans serif fonts (another mapping convention). The most important part now, is to select the placement properties...
Select the following setup: Orientation curved; Postion Above(check), On the Line (check)
Friday, January 25, 2008
ArcGIS Tutorial: Combining/Merging Polygons in ArcGIS
>start editing with the editor toolbar...
>hold shift and select the polygons you would like to merge
>click the editor drop down menu on the editor toolbar
> select merge
>then select the polygon whos properties/attributes you would like the new polygon to preserve.
Then, you are done.
Thursday, January 24, 2008
Google Earth to ArcGIS: Exporting KMZ, KML from GE successfully
The intention, for me, to export this data, is to get it into ArcGIS. If you are looking for methodology for moving Google Earth data to ArcGIS, please read my other post about it.
Saving Google Earth Data as KML or KMZ
Saving and individual point is very straightforward. Right click on the point, click save as, then choose where you would like to save the KMZ file.
To save a polygon or a line - go to the Places pane, expand My Places..., then right click on the feature you wish to save, click save as... and you're done.
If you wish to save multiple features into one KML data set (so you can import them into ArcGIS as one layer), there is currently no methodology for this.
Google Earth to ArcGIS: Importing Google Earth into ArcGIS 9.2
Bringing Stuff from Google Earth to ArcGIS...
If you have made a placemark or a polygon, or a polyline in Google Earth, it is easy to import them into ArcGIS. All you need to do to bring points/lines/polygons from GE to ArcMap is to do the following:
-Create feature in Google EArth
-Right click on it
-Click Save as....
-Save the KMZ/KML file
-Download ET geowizards (if you haven't already, its an amazing ArcGIS toolset)
-on the in/out tab in ET, select import from Google Earth
-select the parameters
There, you have successfully brought google earth data into ArcView!
My wishlist for future versions of ArcGIS (ArcGIS 9.3, ArcGIS 10.X)
Wishlist
- Different Scale for layout view and data view. It's so annoying having to set a bookmark for the layout view so you can get back to the display scale you want. Otherwise, if you have to zoom in to your map in data view, the layout gets all messed up. So annoying. ArcGIS could learn a lesson (somewhat) from AutoCAD's viewport system.
- Lockable features in Layout view (without having to use VBA codes). When you have 1000 elements in your layout view, clicking on one of them can sometimes be maddening.
-Fewer menus for text/feature symbology. Isnt it extremely annoying when you want to add a halo to some types you text or lines, you have to go through about 4-5 screens. Couldnt editing a feature be more streamlined?
-A text editor that feels like it wasn't made in 1995. This goes without being said.
More Soon...
ArcMap: Editing the Entire Field in the ArcGIS Attribute table
1) Click Start EDiting on the editing tools
2) Click the attributes icon on the editor toolbar
3) Right click the layer which contains the attribute that you wish to mass edit at once
4) go to Select > Select All Features
5) Return to the attributes window and select the field you wish to edit (ensuring that you have selected the entire feature rather than just one entry)
6) insert the value you want
Now every shape in the shapefile should have the same attribute in the same field.
Wednesday, January 23, 2008
FREE DATA: Good Sources of Free Canadian GIS Data
With regards to Ontario, you can find a number of OBMs (Ontario Base Maps/Ontario Base Data) for free all over the net. The best source for general data, in my opinion, is:
http://www.geographynetwork.ca
You can select the layers you want, the extent of your study area, the projection and the datum you want the data in. Then you download ESRI shapefiles with exactly what you are looking for.
Some others:
Free Map data For the Guelph, Kitchener Waterloo Cambridge Area:
http://grims.grandriver.ca/imf/imf.jsp?site=grca_datadis&ddsid=25aa6
- download watershed information, and usual boundaries. As well as free ortho imagery! If you love it, and want the whole water shed quickly, you can pay them a small fee for the entire data set on a DVD.
For DEM information for all of Ontario, check out
www.geobase.ca for Ontario DEMs
They dont have the highest pixel resolution size (30 meters if i remember correctly). But they are good for a general or key map/site plan elevation.
More coming soon...
One caveat for any free data - make sure it is accurate and up to date! You dont want to get burned for digitizing a forest that is no longer there.
Monday, January 21, 2008
Printing Issues in ArcGIS: If your layout won't print some layers here is the solution
To assign a projection, in case you do not know, in ArcGIS 9.X, you do the following:
-right click on the data frame
-properties
-then coordinate systems
-check under predefined and pick a coordinate system for your area
This is more of a bugfix than it is anything else. Sometimes ArcEditor can be quite annoying.
This is a solution for Invisible layers in ArcGIS. Or for Hidden Layers in ArcGIS layout view
Scaling AutoCAD viewports to common Geographical scales
The way you do this is the Zoom XP command. Type Zoom (shortcut Z) then> XP and enter one of the values listed in the chart below for the corresponding scale:
Zoom XP | Scale | Zoom XP | Scale |
0.200 xp | 1:5 000 | 4.000 xp | 1:250 |
0.333 xp | 1:3 000 | 5.000 xp | 1:200 |
0.500 xp | 1:2 000 | 6.667xp | 1:150 |
0.666 xp | 1:1 500 | 10.00 xp | 1:100 |
1.000 xp | 1:1 000 | 20.00 xp | 1:50 |
1.333 xp | 1:750 | 25.00 xp | 1:40 |
1.666 xp | 1:600 | 33.33 xp | 1:30 |
2.000 xp | 1:500 | 40.00 xp | 1:25 |
2.500 xp | 1:400 | 50.00 xp | 1:20 |
3.333 xp | 1:300 | 100.0 xp | 1:10 |
Converting AutoCAD blocks/polygons (DWG) to fonts (TTF)
The only way to convert between the two is to do it somewhat manually. I've looked and even tried to program this myself, it just isnt within my capability. Incidentally, if some enterprising young programmer out there was willing to do this, I would be very appreciative!
So, anyhow, this is my methodology for converting AutoCAD polygons/blocks to fonts (in my case, so they can be used as markers in ArcGIS).
1) Save your CAD file as a BMP or a TIF, or some other uncompressed raster image. I would recommend saving it at a scale that you feel you will use the most as a font (even though fonts are scalable).
2) You need a font creation program. There is currently no way around this. If you have the money, there are several programs you can buy for 50-700 USD. If, like me, you dont have this kind of budget for a piece of software you will not be frequently using, then there is a fairly good free software option out there. It has one major drawback, however....
It's not windows software! Which is a drawback when you are clearly using both ESRI ArcGIS and AutoDesk AutoCAD in a Windows environment.
Anyhow, the software is called Font Forge (Google it, it should be at Sourceforge). To even get this program to work and start making your ArcGIS compatible fonts, you need to install Cygwin, which is an application that simulates a UNIX environment.
Once you have gone though the headache of installing that program - there is a very good guide on their website - you are ready to start converting AutoCAD into a font. From within cygwin type:
$ twm &
$ fontforge -new
Read the fontforge guide on how to create fonts. I would highly recommend the autotrace program - if it will work on your system - it will streamline the conversion process somewhat. Once you have created a new .font be sure to import it into your control panel>font folder. Windows will now have a new font that, hopefully, has characters that resemble your original AutoCAD file.
Be sure to read my upcoming article on using these newly created fonts to create ArcGIS markers.
Saturday, January 19, 2008
Implementing Mobile GIS
Implementing Portable GIS : the Guide
Terminology
GIS Geographic Information Systems: (not to be confused with GPS) are a means for creating, storing, and analyzing spatial data.
GPS Global Positioning System: (not to be confused with GIS) is a satellite-based navigation system that can be extremely useful for collecting spatial data.
dGPS Differential GPS: An extremely accurate, but usually more expensive, base station based GPS.
Mobile GIS: essentially allows one to perform GIS tasks in the field with GPS, handheld computers, and/or any other portable electronic device available. This could include data collection, data storage and/or data analysis.
Data Collection
GPS is the obvious means of in the field data collection. Other means of electronic data collection – Total Station, theodilite – are unwieldy, relatively slow, often more expensive, and over-accurate for the type of work we do. The only viable competition to the GPS is to not implement anything if a cost/benefit analysis indicates as much.
GPS Implementation
What is required:
- An accurate handheld GPS or dGPS…
…with mobile GIS software (preferably)
…with USB access
- Necessary training
Data Collection WITH
There are several mobile GIS applications on the market; that being said, ESRI’s ArcPAD is the most used and most directly compatible with the GIS software we have (ArcView 9.2).
What is ArcPad?
It is, essentially, a scaled down, mobile version of ArcMap. It allows the user to store, view and record geographic information on a handheld computer at any location. For instance, an air photo can be underlayed in background while tree points are recorded in real time.
Possible Methodology for Data Collection WITH
1) Record point, line, or polygon features on the fly
2) Assign them to a layer of your choice or create a new layer
3) Add annotation on screen via keypad or by freehand drawing with stylus
4) Plug the unit into an ArcMap enabled PC and directly import the recorded layers to a GIS
5) Symbolize the data appropriately for use in map outputs, geodatabases, etc…
Possible Methodology for Data Collection without
1) Record point or area in the field with GPS
2) Record some kind of annotation, be it on paper or on a PDA, that indicates what feature is at each point location
3) Import recorded points into ArcGIS. Create layers for each of the points (e.g. tree species, shrubs), while attaching annotated data from handwritten notes/PDA.
4) Symbolize the data appropriately for use in map outputs, geodatabases, etc…
Draw backs
1) Recording separate notes can be both time consuming and awkward in sordid weather (if notes are on paper).
2) A missed or misplaced point can be very difficult to identify without returning to the field
3) Can not save data as layers or symbolize data
4) Can not underlay existing data/imagery
Bottom line: if mobile GIS can create efficiency that outweighs its price, then it is worthwhile.
Portable GIS for Navigation
A portable GPS that is mobile GIS capable could help navigate to features in the field more quickly. The rough average of ten meters of accuracy that our current GPS possesses is appropriate to locate large features (e.g. a river), but when the goal is to find an individual piece of vegetation it can be a detriment. In addition, ten meters of accuracy can be even lower when in dense forest growth.
Current Technology
- inaccurate handheld GPS
- HP iPAQ hx2000 series with possible GPS integration
- ArcView 9.2
Possible Technology
- Trimble GeoXH handheld GPS (or equivalent GPS)
- ArcPad software
Friday, January 18, 2008
Dealing with VERY large Raster images in ArcGIS
Before you begin:
1) Set up your layouts, ie. how your map will look, before you even begin. Remember, once the raster has been added, everything will slowwwwwww dowwwwwwwn.
Adding the Raster to the ESRI ArcGIS data view
1)In Data view add the raster image. BUILD PYRAMIDS! Do not ignore this step, it can make matters go from extremely awful to merely agrivating when it comes to speed. Remember, the pyramids were not built in a day, sometimes building pyramids takes a while. So be patient, you might even think the system is hanging, it will take so long.
2) Choose your actions carefully. You may wish to plot out on paper what you are going to do. This is because doing anything really slows you down. Even using the pan tool in ArcView can take 3-5 seconds or even more!
3) In layout view click on the data view pane, right click and select - Draft mode - just show name (unless you need to see the view for adding labels etc...). This will speed things up extremely
4) Don't fret ArcGIS is just a program.
5) Do not run screaming from the room.
Simple AutoCAD to ArcGIS 9.2 Guide (.dwg - > .shp)
This post, as well as this blog, will focus on working in the two environments and making your work mesh together in concert. This post is a guide for to simply add Autodesk Autocad DWG drawings into ArcGIS 9.2. So, without further ado...
As with any ArcGIS document, you need to make sure that you .DWG file is saved in a directory that is no further than two folders from the root drive. In addition, you must make sure that there are no spaces in the folder or filenames. eg. c:\Arc\GIS\cadfile.dwg
Next open and save a ArcMap document in the same folder. There can be spaces in this filename. Add data to the data frame > select the autoCAD document you wish to import. If the CAD is simplistic and is only one layer, you are done! However, since 99% of CAD documents do not fall within this description, you are not done.
The CAD document, by default, combines all the layers, annotation, etc... into one group layer in ArcGIS. You can expand this group layer and see the nonsensical way it displays the 5 layers within it by default - complete with annoying ArcGIS random colours and and strange coordinate/range descriptions. They will fall under categories like annotation, point, polygon, polyline etc... These are the filetypes that ArcGIS is most familiar with, but who wants them in one layer!? And the descriptions of the symbology is equally confusing. eg. continuous 4,62 etc...
Your goal is most likely to seperate the layers back to the point that they used to be when you had them in AutoCAD 2008 (or whatever version you are using). You may want all of the layers or you may want a select few. The process, as of right now, is somewhat confusing. I am currently working on a more streamlined process and will be blogging about it soon. But for now here is the method for extracting autocad layers from ArcGIS:
To do this, we must first right click on the CADD layer within the group layer > properties > drawing layers tab > then click disable all > then click the first of the layers you want to isolate (only one unless you want to combine several layers into one layer).
Close the window > right click again on the layer > go to data > expand it > click export data...
> chose a place to save the file and a file name and voila!
You have a layer that is an ESRI shape file (.shp). You can repeat this conversion process for each of the AutoCAD layers you want made into ESRI ArcGIS layers.
As I said, I am currently writing code to streamline this process and it will be done and posted on these forums soon!
Thursday, January 17, 2008
Georeferencing and Georectifying AutoCAD documents
The answer is simple:
Wednesday, January 16, 2008
Copying and Pasting Groups of Text Elements in ArcGIS
The problem: when you select and copy/paste large groups of ArcGIS text, they lose their formatting and become askew.
Solution: When you copy the text, you need to note the percentage of zoom on the layout. eg. 25%. When you paste to another area, layout in a different ArcGIS mxd document, make sure that the percentage is the same. You should have few problems then.
AutoCAD Lesson: Matching the style of one feature to other features
1) type the command MA
2) click the input feature (with the properties you wish to transfer)
3) click the feature(s) in CAD that you want to give new properties to
There! Your feature should all have the same colours, line weights, line types, scale and any other property you can image.
AutoCAD lesson: Moving an object from paper space to model space without changing the scale and/or location
You can move an object from paper space to model space (or vice versa) in AutoCAD 2008 by simply copy + paste. But what if the object is scaled and you want to maintain the scale in the conversion? The scale of paper space is 99.9% of the time a different from the scale in model space/your viewport. So, to preserve that relative scale in the conversion you need to do the following:
In AutoCAD…
1) select all the features you wish to convert
2) click the modify drop down > then click change space.
The features you have selected should move from the paper space to your viewport.
Conversely, if you wish to bring a feature from a CAD drawing’s model space back to the paper space, then you need to do the following:
In AutoCAD
1) Double click on the viewport that contains the features you wish to bring back (first make sure the viewport is not locked)
2) Click the features you wish to bring to the paper space
3) click the modify drop down > then click change space.
The features should now be back into your paper space with their scale and location intact.
Converting ArcGIS to Autocad: the easy way
Method 1: For ArcView and ArcEditor
If you are stuck with either of the lesser licences, use this method. If you have ArcInfo (the top licence), skip to method 2.
1) Open ArcCatalogue
2) Select the shapefile you wish to convert.
3) right click on it and select export... then shapefile to DXF...
4) Select an output path (dont worry about decimals for now)
You can repeat this process in ArcGIS the same way and select batch if you wish to do this to multiple shapefiles at once.
Method 2: For those of us with ArcInfo
1) Open ArcCatalogue
2) Select the shapefile you wish to convert.
3) right click on it and select export... then click Export to CAD
4) Then select DWG. You can export directly to a DWG file with ArcInfo. If you dont have ArcInfo use method 1 and cry.
Reading my additional articles on importing ArcGIS into AutoCAD for more information...
Tuesday, January 15, 2008
Dissapearing or moving Custom Toolbars in ArcGIS
When you make a custom toolbar, make sure you save it to normal.mxt (or the template you normally use). Otherwise, when you load ArcGIS will not see it again unless you load the map document (.mxd) you were working on when you saved the toolbar. If you didnt save the document, then you have completely lost your changes.
If you create you own UIcontrols and save them, they are also attached to the document you choose. Again, if you save your ArcGIS UIcontrol in the mxd document, it will not load in a new document. Also, when scripting, be sure to write all of your codes in the mxt template module, or again, you will lose your changes (you can always copy and paste it over if you forget).
Even more annoying is getting your Toolbars to stay in the location you assign them when you reload ArcMap. This part requires VBA programming:
codes Coming soon
Converting AutoCAD blocks to ArcGIS markers: Can it be done?
The answer is yes, sort of. It depends on the application and how loosely you define the word 'convert'. Another person might use the word re-create instead. Just to clarify, this guide only applied to point features in ArcGIS, you can search my other posts for a guide on how to convert AutoCAD blocks into polygons or lines in Arc.
There are two methods I currently use to convert from CAD blocks to GIS markers (points):
Method # 1: Saving as a .bmp (windows bitmap)
This method is only useful if you do not ever need to scale the marker to a size larger or smaller than how you create it. If you do need to scale it, but only to one or two other sizes, you can just repeat this process for two additional symbols.
To begin, you need to export the file you want from AutoCAD to a bitmap document. There are a variety of ways to do this, you can read about it elsewhere in my blog. Or elsewhere on the internet for that matter.
Once this is done, you can import the marker to your ESRI ARcGIS styles manager. There is a guide to use your styles manager also in this blog. However, the quick solution is to go to TOOLS>STYLES>STYLE MANAGER is ArcGIS. In there, go to the style file that you are using (either your user name, ESRI, or another file you have created - this is recommended). In this ESRI ArcMap style file, you need to select 'marker symbols'>right click on the right pane> new...
Then select picture marker symbol> select the bmp you exported from AutoCAD and voila. You are done. The reason I say not to scale is more of a guideline than a rule. ArcGIS is terrible at scaling images (think MS Paint, but worse). A scaled symbol from a bitmap will look completely wrong. So, as I mentioned earlier, if you want to import a CAD to ArcGIS symbol into bmp, make one for each point size you would like for the marker.
If you DO need to scale your marker, then a much more complicated methodology is required...
Method # 2: Creating an ArcGIS marker from a custom TTF (True Type Font)... SEE PART 2
Monday, January 14, 2008
DXF & DWG files in ESRI programs
This article contains information about DXF and DWG files in ArcGIS, (ArcView, ArcEditor, ArcInfo). The info is easy to access and is in point form.
- can’t edit with editor tools
- have weird symbology
- consist of a layer set with 5 layers
o annontation
o point
o polygon
o polyline
o multipatch
- eacgh of these layers can be turned on/off, used for symbology, assigned a coordinate system and any other data type options
- they can be exported as a shapefile
- in the CAD properties menu, different CAD layers can be turned on/off, but not in the table of contents. Here they remain as symbology only
AutoCAD to ArcGIS Conversion Compatibility Report
The following are the versions of AutoCAD that I am certain will import into ArcGIS (older versions may also work, I just have not experimented:
AutoCAD 2008 (Release 22)
AutoCAD 2007 (Release 21)
AutoCAD 2006 (Release 20)
AutoCAD 2005 (Release 19)
AutoCAD 2004 (Release 18)
AutoCAD 2002 (Release 17)
AutoCAD 2000i(Release 16)
AutoCAD 2000 (Release 15)
The following are the versions of ArcGIS that, for sure, support importing
ArcGIS 9.2 ArcGIS 9.1 ArcGIS 9.0 ArcGIS 8.3 ArcGIS 8.2
See our Guide: how to convert ArcGIS to AutoCAD
Thursday, January 10, 2008
Making Attractive layouts in ArcGIS
This article contains general tips for making an attractive layout in ArcGIS 9.2, ArcGIS 9.1 or ArcGIS earlier.
- use rulers on the layout menu. Make sure to set the smallest division to a low number
- also enable snap elements to guides and rulers
- use guides often. Use them to delineate the general area of your ArcGIS layout.
- Be consistent in your layout. Use the same template for all projects that you do. This will make your GIS work look extremely professional
- use alignment to line all of your elements up