Hi,
I'm attempting to create a program that imports a set of postal sectors into mappoint as a territory code below.
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?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
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?Code:objDataset = mobjMapPoint.ActiveMap.DataSets.ImportTerritories(mstrFilename, System.Reflection.Missing.Value, GeoCountry.geoCountryUnitedKingdom, GeoDelimiter.geoDelimiterComma, )
Thanks
Andy