MapPoint pushpins not showing on map

Posted on 2009-12-28
Last Modified: 2013-11-26
For some reason, my pushpins are not showing in my VB 2008 application.  When I use just the 3 columns as shown in this URL ( and use a simple dummy file with just "lat", "long", and "name", it works fine.  As you can see from the code, I have expanded this to accomodate more data, but now nothing shows on the map.  TIA.

Also, the bit at the end where it's supposed to center on a pin isn't working. I know for sure there is an entry by that name in the CSV.

The .csv file and the .rpt file are being created perfectly, but does it matter in which order the fields are organized in the csv?  Looking at the code, I didn't think it did.
Dim objDataSets As MapPoint.DataSets

        Dim objDataSet As MapPoint.DataSet

        Dim zDataSource As String

        Dim myLong As String

        Dim myLat As String

        Dim myName As String

        Dim myMeterID As String

        Dim myIntDate As String

        Dim myIntTime As String

        Dim mysignal As String

        Dim mygatewayID As String

        Dim mys2 As String

        Dim location As MapPoint.Location

        Dim pushpin As MapPoint.Pushpin

        Dim centreMap As MapPoint.Pushpin

        Dim xFieldArray(0 To 8, 0 To 1) As Object

        'Use the lat field as the Latitude

        xFieldArray(0, 0) = "lat"

        xFieldArray(0, 1) = MapPoint.GeoFieldType.geoFieldLatitude

        'Use the long field as Longitude

        xFieldArray(1, 0) = "long"

        xFieldArray(1, 1) = MapPoint.GeoFieldType.geoFieldLongitude

        'Use the name field as the Name

        xFieldArray(2, 0) = "name"

        xFieldArray(2, 1) = MapPoint.GeoFieldType.geoFieldName

        xFieldArray(3, 0) = "MeterID"

        xFieldArray(3, 1) = MapPoint.GeoFieldType.geoFieldData

        xFieldArray(4, 0) = "IntDate"

        xFieldArray(4, 1) = MapPoint.GeoFieldType.geoFieldData

        xFieldArray(5, 0) = "IntTime"

        xFieldArray(5, 1) = MapPoint.GeoFieldType.geoFieldData

        xFieldArray(6, 0) = "signal"

        xFieldArray(6, 1) = MapPoint.GeoFieldType.geoFieldData

        xFieldArray(7, 0) = "GatewayID"

        xFieldArray(7, 1) = MapPoint.GeoFieldType.geoFieldData

        xFieldArray(8, 0) = "s2"

        xFieldArray(8, 1) = MapPoint.GeoFieldType.geoFieldData

        zDataSource = "C:\gatewaydata\myData.csv" 'this is our data file

        objDataSets = FrmMain.AxMappointControl2.ActiveMap.DataSets

        objDataSet = objDataSets.LinkData(zDataSource, "name", xFieldArray, MapPoint.GeoCountry.geoCountryUnitedStates, MapPoint.GeoDelimiter.geoDelimiterComma) 'links to the data file rather then imports it 

        'now loop through each data element, assign it to a variable and use the variable to plat a pushpin position

        For Each objField In objDataSet.Fields

            myLong = objDataSet.Fields("long").Value 'this is my longitude

            myLat = objDataSet.Fields("lat").Value 'this is my latitude

            myName = objDataSet.Fields("name").Value ' name of the position

            myMeterID = objDataSet.Fields("MeterID").Value

            myIntDate = objDataSet.Fields("IntDate").Value

            myIntTime = objDataSet.Fields("IntTime").Value

            mysignal = objDataSet.Fields("signal").Value

            mygatewayID = objDataSet.Fields("GatewayID").Value

            mys2 = objDataSet.Fields("s2").Value

            location = FrmMain.AxMappointControl2.ActiveMap.GetLocation(myLong, myLat) 'plot the position

            pushpin = FrmMain.AxMappointControl2.ActiveMap.AddPushpin(location, myName) 'add a pushpin to that position

            pushpin.BalloonState = 2 'set the balloon display WHEN THE PUSHPIN IS CLICKED

            pushpin.Symbol = 0 'set the pushpin symbol

        Next objField

        'when all the positions are plotted, line up on one of the pins

        centreMap = FrmMain.AxMappointControl2.ActiveMap.FindPushpin("David Jones")


        'zoom into the display


Open in new window

Question by:LD147
    1 Comment
    LVL 1

    Accepted Solution

    This can be closed.  I managed to export the report data to an Excel file and then used the attached code to display the data on the map.

    Dim objDataSets As MapPoint.DataSets
            Dim objDataSet As MapPoint.DataSet
            Dim zDataSource As String
            zDataSource = "C:\gatewaydata\myData.xls"
            objDataSets = FrmMain.AxMappointControl2.ActiveMap.DataSets
            objDataSet = objDataSets.ImportData(zDataSource)

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now