MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




At my wits end with mappoint & ImportTerritories() with VB.NET

This is a discussion on At my wits end with mappoint & ImportTerritories() with VB.NET within the Development forums, part of the MapPoint 2006/2009 Discussion category; Hi, I'm attempting to create a program that imports a set of postal sectors into mappoint as a territory code ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion > Development

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (3) Thread Tools Display Modes
  3 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 09-25-2007
Junior Member
White Belt
 
Join Date: Sep 2006
Posts: 2
Unhappy At my wits end with mappoint & ImportTerritories() with VB.NET

Hi,

I'm attempting to create a program that imports a set of postal sectors into mappoint as a territory code below.

Code:
    Private Sub ImportDataTableInvoke(ByVal DataTable As DataTable)
        mobjMapPoint.NewMap(GeoMapRegion.geoMapEurope)
        mobjMapPoint.Visible = False
        Try
            ' TempFile
            Dim stmTempFile As New IO.StreamWriter(mstrFilename, False)
            ' Headings
            stmTempFile.WriteLine("Name, PostcodeSector")
            ' Loop though the record set
            For Each rowDataRow As DataRow In DataTable.Rows
                stmTempFile.WriteLine(CStr(rowDataRow("Territory")) & "," & CStr(rowDataRow("PostcodeSector")).ToLower)
            Next
            ' Close file
            stmTempFile.Close()

            Dim Fields(,) As Object = { _
                {"Name", GeoFieldType.geoFieldTerritory}, _
                {"PostcodeSector", GeoFieldType.geoFieldPostal3} _
                                      }

            Dim objDataset As MapPoint.DataSet

            objDataset = mobjMapPoint.ActiveMap.DataSets.ImportTerritories(mstrFilename, Fields, GeoCountry.geoCountryUnitedKingdom, GeoDelimiter.geoDelimiterComma, )
            ' Set the map style
            mobjMapPoint.ActiveMap.MapStyle = GeoMapStyle.geoMapStyleData
            ' Zoom in
            objDataset.ZoomTo()
            ' Success 
            mblnImportFailed = False
        Catch ex As Exception
            Debug.WriteLine(ex.ToString)
            mblnImportFailed = True
        End Try
    End Sub
The above returns the error message 'The territory set was empty, so territories were not created on the map and the set was deleted.' I have no idea what that means?

The other weird and strange thing is if I let mappoint decide whats best by importing using the code below

Code:
objDataset = mobjMapPoint.ActiveMap.DataSets.ImportTerritories(mstrFilename, System.Reflection.Missing.Value, GeoCountry.geoCountryUnitedKingdom, GeoDelimiter.geoDelimiterComma, )
Mappoint will draw the map but on a few datasets it returns 'No matching method defined for these fields.' I'm taking this to be that mappoint doesn't know where that postcode sector is? if so how do I get around this error?

Thanks

Andy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 09-26-2007
Senior Member
Green Belt
 
Join Date: Oct 2003
Location: London
Posts: 102
Re: At my wits end with mappoint & ImportTerritories() with VB.NET

Hi Andy. This will probably be of no help whatsoever as I know nothing about programming in vb.net. However I have set up various territories definitions in the UK based on postal geography both manually and using vba in excel. I used to get lots of error messages and incorrect plotting of sectors until it became apparent that there is a casing problem in MPE2006 and that the only way to get around this is to read the sector names in lower case rather than upper case eg kt17 4 instead of KT17 4. Not sure if your frustrations could be wound up with this but it might be worth giving it a try.

Rgds
__________________
David
MapPoint Europe Gallery at http://www.broomanalysis.plus.com/gallerylist.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 09-26-2007
Junior Member
White Belt
 
Join Date: Sep 2006
Posts: 2
Re: At my wits end with mappoint & ImportTerritories() with VB.NET

Thanks for your reply and have found that problem with the uppercase before, and at the time that caused a headacke.

I have solved my problem by;

Creating a MapPoint file with the territory dataset linked to a file and opening that file within my application as a template. The territory file is updated within my application and eachtime the territory dataset gets updated using 'mobjMapPoint.ActiveMap.DataSets.Item(1).UpdateLin k()'. Much to my amazement not even that always works and sometimes produces a COM error stating that the dataset has failed to be updated (always the same files). But even more amazing is if I call that above function for a second time the file links correctly. I also tried this updating within mappoint and the same happens.


My conculsion is that MapPoint is pap! It's a peice of software that just about works

Arh well.

Thanks

Andy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
end, importterritories, mappoint, vbnet, wits


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/my-wits-end-mappoint-importterritories-vb-net-6416.html

Posted By For Type Date
Microsoft MapPoint 2006 - MP2K Magazine This thread Refback 09-27-2007 09:19 AM
MapPoint Automation with C/C++ - Part 2 - MapPoint Articles - MP2K Magazine This thread Refback 09-26-2007 12:56 PM
The Magazine for MapPoint - MP2K Magazine This thread Refback 09-26-2007 08:48 AM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 07:32 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Wengen Skiing
Wengen is known as one of those classic Swiss ski resorts that have a relaxed atmosphere and stunning scenery. Experience Wengen skiing holidays yourself, book online.

Flights to Turkey
Find and book flights to Turkey. Travel Counsellors can help with travel to Turkey including flights and accommodation.

Holiday in Turkey
A Holiday in Turkey is great value when you book with dealchecker.co.uk. There is an abundance of things to see and do. Check out the well-preserved Greco-Roman ruins.

Holidays in Egypt
A holiday in Egypt will stimulate your mind, captivate your heart and spark your senses. Visit this exceptional country, book today!

Greece
Greece covers a large area and as a result there is an abundance of things to do, see and taste. You can relax on a beach, visit ancient sites or make a trip to one of the islands like Corfu, Crete or Rhodes.

Cheap Travel
For cheap travel options, visit Travel.co.uk and explore the benefits of our comparison site.

Holidays to Portugal
Want to take your family on a summer holiday? Visit On The Beach for more information on holidays to Portugal.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52