Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| 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 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, ) Thanks Andy |
| |||
| 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 |
| |||
| 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 |
![]() |
| Tags |
| end, importterritories, mappoint, vbnet, wits |
| ||||
| 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 | |
| |
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.