MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




using ImportData with VBScript

This is a discussion on using ImportData with VBScript within the Development forums, part of the MapPoint 2006/2009 Discussion category; Unfortunately it is not working with the above code. Only if i start the import without this array and a ...


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 Thread Tools Display Modes
  #11 (permalink)  
Old 02-06-2008
Junior Member
White Belt
 
Join Date: Dec 2007
Location: Germany
Posts: 9
Re: using ImportData with VBScript

Unfortunately it is not working with the above code.
Only if i start the import without this array and a header line in the file, i can do the import silently - but i have to choose a special header line for the import file to make MapPoint recognizing the content of the columns automatically.

Pit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12 (permalink)  
Old 02-09-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Re: using ImportData with VBScript

Hi,

I did a quick test writing to a file and import it using code below. It works very good. Eventually you try it and check for differences.

Code:
double lat;
double lon;
string fileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName) + "\\temp.csv";

TextWriter writer = new StreamWriter(fileName, false);
try {
	writer.WriteLine("Lat;Lon");
	lat = 51;
	lon = 4;
	for (int k = 0; k < 3000; k++) {
	    writer.WriteLine(lat.ToString() + ";" + lon.ToString());
	    lon += .0003;
	}
} finally {
	writer.Close();
}

MapPoint.DataSet dataSet;

// Define field specification
object[,] fieldSpecifications = null;
fieldSpecifications = new object[2, 2];

// Specify what fields are geographic and what fields are not
fieldSpecifications[0, 0] = "Lat";
fieldSpecifications[0, 1] = MapPoint.GeoFieldType.geoFieldLatitude;
fieldSpecifications[1, 0] = "Lon";
fieldSpecifications[1, 1] = MapPoint.GeoFieldType.geoFieldLongitude;
dataSet = MP.ActiveMap.DataSets.ImportData(fileName, 
				       fieldSpecifications, 
				       MapPoint.GeoCountry.geoCountryDefault,
				       MapPoint.GeoDelimiter.geoDelimiterSemicolon, 0);
dataSet.Symbol = 37;
dataSet.ZoomTo();
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13 (permalink)  
Old 02-11-2008
Junior Member
White Belt
 
Join Date: Dec 2007
Location: Germany
Posts: 9
Re: using ImportData with VBScript

Thank you for your answer!

This code doesn't seem to be VbScript? What Language ist it? C#?

writer.WriteLine("Lat;Lon");

means, that you add a header line to that file.

In my example I do not add a header line and I use TAB as delimiter, because ; may exist as field content.

Pit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14 (permalink)  
Old 02-15-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Re: using ImportData with VBScript

Hi,

Yes example is in C#. Yes I use always a header, maybe that's the reason. But now you can easy compare. I "think" if the delimiting character is in a string and you put the string into quotes "" then you can have it in there. Not sure but easy found with a little experiment.
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
importdata, vbscript


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

Similar Threads

Thread Thread Starter Forum Replies Last Post
ImportData lacja MapPoint 2006/2009 Discussion 6 11-19-2006 10:57 AM
MapPoint 2002 with ASP (vbscript) eatech MapPoint 2006/2009 Discussion 6 05-05-2005 05:12 AM
ImportData Anonymous MapPoint 2006/2009 Discussion 0 11-04-2004 04:05 AM
Will Pay $$$ for Assistance - ASP / VBSCRIPT webdbx MapPoint 2006/2009 Discussion 1 07-09-2004 09:31 PM
Clientside VBScript and MapPoint? Anonymous MapPoint 2006/2009 Discussion 4 03-14-2004 06:34 PM


All times are GMT -5. The time now is 12:06 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


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 53 54