Pee Dee GIS Users Group

Archive for the ‘Tips and Tricks’ Category

Creating a Locator Frame in ArcGIS 10 if you use data driven pages

Posted by trippcor on November 29, 2010

I, like many of you, have used the old DS Mapbooklet Plotting sample code for many years. It has been a wonderful tool and one I cannot do without. ArcGIS 10 introduced Data Driven Pages which basically incorporated much of the DS Mapbook code directly into the core ArcGIS Desktop products.  The one thing that has been driving me crazy is how to reproduce the local Map Locator that DS Mapbook had. I found the following steps on the ArcGIS Forums today posted by David B from Esri.

Create a Map Locator Frame

You can do this with the data frame extent options. In 10.0 there are new options that allow you to drive the extent of one data frame based on the extent of another data frame.

To make a locator map that automatically adjusts as you page through your map series try this:

  1. Go to the properties dialog for your locator data frame and select the Data Frame tab.
  2. In the Extent section at the top select “Other Data Frame” from the dropdown.
  3. Now you should see options to “Derive the extent from another data frame’s extent”. Make sure the DDP data frame is selected in this dropdown (it might show a different data frame selected by default if you have more data frames in your map).
  4. Set the margin options if you want a consistent margin, or select “Zoom to features that intersect the other data frame’s extent” if you want to make sure surrounding features show. The latter is useful if you index layer is a rectangular grid, for example.

Here is the link to the original source I found this on: http://forums.arcgis.com/threads/16422-Map-Locator-with-DD-Map-Book

Hopefully many will find this as helpful as I have.  

Tripp Corbin, CFM, GISP

Posted in Tips and Tricks, Training | Leave a Comment »

Access your GPS Radio with VB.Net code

Posted by pdusers on November 18, 2010

What follows is the code for a module that can be inserted into a VB.net project. Call the sub with the comm port that the GPS radio is on and you are set. Also add a Serial Port Control to your form and name it “serialPort”. Timeout is required in case an incorrect serial port has been specified.

Programming note: Even with the timeout set in the code, the application will lock up if an incorrect, but active comm port has been specified. If you know of a fix post it in the comments.

Imports System
Imports System.IO.Ports

Module gps

    Public strLatitude As String = ""
    Public strLongitude As String = ""

    Public Sub queryGPS(ByVal cPort As String)
        Dim loopCount As Integer = 0
        Dim GPSOutput As String = ""
        Dim GPSGPRMCStr As String = ""
        Dim newLineStr As String = "$"
        Dim aStrSplitItems() As String
        Dim NSHemi As String = ""
        Dim EWHemi As String = ""
        Dim EW As Integer = 0
        Dim NS As Integer = 0
        Dim commQuit As Boolean = False
        Dim portClosed As Boolean = False
        Dim dblLatitude As Double = 0
        Dim dblLongitude As Double = 0
        Dim wsLatitude As String = ""
        Dim wsLongitude As String = ""
        'Set sentence to parse from GPS Output. Use GPRMC GPGLL, or GPGGA
        Dim strSentence As String = "GPRMC"

        'Reset coordinate variables()
        strLatitude = ""
        strLongitude = ""

        On Error GoTo Errhandler

        'Calls Serial Port Control on main form. Add Serial Port Control to form and name it "serialPort"
        'Timeout is required in case an incorrect serial port has been specified. Application will freeze
        'if timeout is missing or too lengthy.
        frmMain.serialPort = New SerialPort("COM" & cPort, 4800, Parity.None, 8, StopBits.One)
        frmMain.serialPort.ReadTimeout = 5
        frmMain.serialPort.Open()

readLine:
        Dim cCount As Integer = 0

        If portClosed = True Then
            frmMain.serialPort.Open()
            portClosed = False
        End If
        'Read GPS data from Device - Geographic Position, Latitude/Longitude
        GPSOutput = frmMain.serialPort.ReadLine.ToString
        GPSGPRMCStr = GPSOutput

        'Test string for debugging without a good GPS signal
        'GPSGPRMCStr = "GPRMC,174607.000,A,3411.3450,N,07946.0365,W,0.44,160.26,020910,,*12"

        If GPSGPRMCStr.Contains(strSentence) Then
            commQuit = True

            For i = 1 To Len(GPSGPRMCStr.ToString)
                If Mid$(GPSGPRMCStr.ToString, i, 1) = "," Then cCount = cCount + 1

                Select Case strSentence 'Set the line the program reads in the DIM statement above
                    Case "GPRMC"
                        Select Case cCount
                            Case 3 'Start collecting latitude
                                strLatitude = strLatitude & Mid$(GPSGPRMCStr.ToString, i, 1)
                            Case 4 'Get Hemisphere
                                NSHemi = NSHemi & Mid$(GPSGPRMCStr.ToString, i, 1)
                            Case 5 'Start Collecting longitude
                                strLongitude = strLongitude & Mid$(GPSGPRMCStr.ToString, i, 1)
                            Case 6 'Get Hemisphere
                                EWHemi = EWHemi & Mid$(GPSGPRMCStr.ToString, i, 1)
                        End Select
                    Case "GPGGA"
                        Select Case cCount
                            Case 2 'Start collecting latitude
                                strLatitude = strLatitude & Mid$(GPSGPRMCStr.ToString, i, 1)
                            Case 3 'Get Hemisphere
                                NSHemi = NSHemi & Mid$(GPSGPRMCStr.ToString, i, 1)
                            Case 4 'Start Collecting longitude
                                strLongitude = strLongitude & Mid$(GPSGPRMCStr.ToString, i, 1)
                            Case 5 'Get Hemisphere
                                EWHemi = EWHemi & Mid$(GPSGPRMCStr.ToString, i, 1)
                        End Select
                    Case "GPGLL"
                        Select Case cCount
                            Case 1 'Start collecting latitude
                                strLatitude = strLatitude & Mid$(GPSGPRMCStr.ToString, i, 1)
                            Case 2 'Get Hemisphere
                                NSHemi = NSHemi & Mid$(GPSGPRMCStr.ToString, i, 1)
                            Case 3 'Start Collecting longitude
                                strLongitude = strLongitude & Mid$(GPSGPRMCStr.ToString, i, 1)
                            Case 4 'Get Hemisphere
                                EWHemi = EWHemi & Mid$(GPSGPRMCStr.ToString, i, 1)
                        End Select
                End Select
            Next
        Else
            GoTo readLine
        End If
        strLatitude = Microsoft.VisualBasic.Right(strLatitude, Len(strLatitude) - 1)
        NSHemi = Microsoft.VisualBasic.Right(NSHemi, Len(NSHemi) - 1)
        strLongitude = Microsoft.VisualBasic.Right(strLongitude, Len(strLongitude) - 1)
        EWHemi = Microsoft.VisualBasic.Right(EWHemi, Len(EWHemi) - 1)

        If NSHemi <> "" Then
            If NSHemi = "N" Then NSHemi = "" Else NSHemi = "-"
            If EWHemi = "E" Then EWHemi = "" Else EWHemi = "-"
        End If

        'Convert Lat and Long to decimel
        '********************************************************************
        'Strip leading Zeros
        dblLatitude = CDbl(strLatitude.ToString)
        dblLongitude = CDbl(strLongitude.ToString)
        'Add polarity
        If NSHemi = "-" Then
            dblLatitude = dblLatitude * -1
            NS = -1
        Else
            NS = 1
        End If
        If EWHemi = "-" Then
            dblLongitude = dblLongitude * -1
            EW = -1
        Else
            EW = 1
        End If

        'Move decimel place two places to the left
        dblLatitude = dblLatitude / 100
        dblLongitude = dblLongitude / 100

        'Get values left of decimel
        Dim leftLat As Integer = Math.Abs(dblLatitude)
        Dim leftLong As Integer = Math.Abs(dblLongitude)

        'Get values right of decimel
        Dim rightLat As Double = Math.Abs(dblLatitude) - Math.Abs(leftLat)
        Dim rightLong As Double = Math.Abs(dblLongitude) - Math.Abs(leftLong)

        'Convert to minutes
        rightLat = (rightLat * 100) / 60
        rightLong = (rightLong * 100) / 60

        'Lat/Long in decimel, in case you need decimel degrees instead of degrees/minutes/seconds.
        wsLatitude = Trim(Str(CDbl(strLatitude) * NS))
        wsLongitude = Trim(Str(CDbl(strLongitude) * EW))

        'Lat/long in Degrees/Minutes/Seconds in decimel form
        strLatitude = Trim(Str((leftLat + rightLat) * NS))
        strLongitude = Trim(Str((leftLong + rightLong) * EW))

        frmMain.serialPort.ReadBufferSize = 0
        frmMain.serialPort.Close()
        portClosed = True

        '*********************************************************************
        'Comment out else section when deployed. Work with results in main sub
        '*********************************************************************
        'Sometimes reception is poor and it takes more than one pass of the data to get a fix
        'This section forces another read of the GPS device when the coordinates are null or
        'contain zeros. Note: The application as written will fail on the prime meridian when
        'at the equator.
        If strLatitude = "" Or strLongitude = "" Or strLatitude = "0" Or strLongitude = "0" And commQuit = True Then
            loopCount = loopCount + 1
            If loopCount > 10 Then
                MsgBox("The GPS device is currently not getting a fix, please try again later." _
                      & Chr(10) & GPSOutput, vbOKOnly, "Satellite Communication Unavailable")
                Exit Sub
            Else
                GoTo readLine
            End If
        Else
            'Access web service from arc to return a list of addresses within a certain range of the inspector's location.
            'Web Service is currently in SC stateplane.

            'A google test.
            'System.Diagnostics.Process.Start("http://maps.google.com/maps?q=" & strLatitude & "%2C" & strLongitude)
        End If
        '********************************************************************
        Exit Sub
Errhandler:

        Select Case Err.Number
            Case 5
                Resume Next
            Case 13
                'MsgBox(Err.Number & " " & Err.Description)
                Resume Next
            Case 57
                'MsgBox(Err.Number & " " & Err.Description)
                MsgBox("Comm Port not available", MsgBoxStyle.Exclamation, "Communication Error.")
                Exit Sub
            Case 91
                'MsgBox(Err.Number & " " & Err.Description)
                Resume Next
            Case 8002
                'GPSComm.PortOpen = False
                MsgBox("Comm Port not available", MsgBoxStyle.Exclamation, "Communication Error.")
                'GPSComm.PortOpen = True
                Resume Next
                Exit Sub
            Case Else
                MsgBox(Err.Number & " " & Err.Description)
                Resume
                Resume Next
        End Select
    End Sub
End Module

 

Posted in Tips and Tricks, Visual Basic .Net/ ASP.Net | Leave a Comment »

Converting an ArcGIS 10 GDB to ArcGIS 9.3 or earlier

Posted by trippcor on July 23, 2010

I was just asked by a client how to convert a newly created GDB in ArcGIS 10 to one that could be read by ArcGIS 9.3. Before 10, I would normally do this by moving everything to a personal GDB and editing the GDB_ReleaseInfo table to have the values the older versions expected to see. This always worked great as long as your GDB was fairly simple without a lot of higher end features such as geometric networks or parcel fabrics.

ArcGIS 10 however has completely revamped the personal Geodatabase schema so the GDB_ReleaseInfo table does not exist and I have not been able to find a table that contains similar information. So this method will no longer work for converting back to older versions. ESRI recommends if you want to convert to an older version, you should create a new GDB using an older version of the software. Then copy and paste the data from the ArcGIS 10 GDB to the newly created older version GDB from an ArcGIS 10 install. This is great if you have a computer installed with the older version but what do you do if you don’t.

One option I found is to create layer packages. When creating a layer package it has the option to create one that is compatible with older versions of ArcGIS. Here is a link to the online help with more information. If anyone else has ideas or methods they use I would be interested in hearing them.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//0017000000q4000000.htm

Tripp Corbin, MCP, CFM, GISP
Vice President, GIS/IT
ESRI Authorized Instructor
CompTIA Certified Technical Trainer
Keck & Wood, Inc.
(678) 417-4013
(678) 417-4055 fax

Posted in Announcements, Tips and Tricks | 7 Comments »

ArcGIS to Adobe Illustrator

Posted by James Mccall on July 8, 2010

Occasionally you might get a request to supply someone with a map that they can use in a Adobe Illustrator. ArcGIS gives you the tools you need to do this, but to avoid trial and error here’s a quick tip for outputting your map to an Adobe Illustrator compatible format.

Design your map in ArcGIS and once finished:

  1. Click File-Export Map
  2. In the Save as Type drop down, select EPS (*.eps)
  3. In the Options section, click the Format tab.
  4. Set your options as shown below.


By setting your output as shown the recipient will be able to work with your annotations and read them since using embedded fonts may cause issues in Illustrator.

Posted in Tips and Tricks | Leave a Comment »

ArcGIS 10 License provisioning for multiple single-use licenses

Posted by trippcor on June 23, 2010

Looks like ESRI is starting to let folks download the final release of ArcGIS 10. I was able to download ours yesterday. For those of you that opted for the download option, if you have not received you email with instructions yet, I am sure you will be soon.

One of the many things that have changed with the release of 10 is how you get your license files. ESRI has a new customer portal that allows you to allocate all your various licenses and generate provisioning files. A provisioning file is a text file that can be used to pre-populate user information and authorization numbers in the Software Authorization Wizard instead of manually entering the information. For the ArcGIS License Manager, the provisioning file is in the format *.prvs. For ArcGIS Desktop, Engine, Server, the provisioning file is in the format *.prvc.  For those that run concurrent licenses, this is very similar to the license files we always received. It will work a little differently for single use licenses especially if you have multiple licenses.

If you have multiple single use licenses, when you go to generate provisioning files for those licenses, you will have to allocate and generate a file for each individual computer you plan to assign a license. For example we have 5 single use ArcView licenses. I cannot generate one provisioning file allocating all 5 of my licenses and use it to install on 5 different computers. Instead I must generate five different provisioning files.  

For additional information go to:  https://customers.esri.com/index.cfm?event=general.dspHelp&topic=authorizations

 You may need to login to your ESRI global account to access the link. Hopefully this will help as you start to migrate to ArcGIS 10.

Posted in Tips and Tricks | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.