MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




GetMap(spec) Exception..Pokect Application

This is a discussion on GetMap(spec) Exception..Pokect Application within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I'm using the method findNearbySpec and I proved this method in a pocket application. I found many places but there ...


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

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



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-24-2005
Junior Member
White Belt
 
Join Date: May 2005
Posts: 8
GetMap(spec) Exception..Pokect Application

I'm using the method findNearbySpec and I proved this method in a pocket application. I found many places but there is an error that i can quit.

SystemNullReferenceException //when I try to use GetMap

Code:
MapImage[] mapImgs;
mapImgs = render.GetMap(spec);
Bitmap bMap = new Bitmap(new System.IO.MemoryStream(mapImgs[0].MimeData.Bits));
pictureMapPoint.Image=bMap;
I prove the same code in a windowsApplication a and that wroks fine. I view the the map.

I prove the find method findAddressSpec and the GetMap in the pocket, I don't have any Exception, and I see the map

Does anyone one the problem??
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 05-24-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: GetMap(spec) Exception..Pokect Application

Hi,

Eahter render or spec is probably null. Can you not check with debugger ?
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 05-24-2005
Junior Member
White Belt
 
Join Date: May 2005
Posts: 8
Hi, Wilfried

Noup, they are not null, neither spec, nor render

and the problem is that the same code is working fine in a windowsApplication (not in the pocketApplication)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 05-24-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

please show the code you use in GetMap(). probalbly the problem is in there.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 05-24-2005
Junior Member
White Belt
 
Join Date: May 2005
Posts: 8
Hi, look..

Code:
MapView[] views = new MapView[1];
ViewByScale viewByScale = new ViewByScale();
viewByScale.CenterPoint = llCenter;
views[0] = viewByScale;
MapSpecification spec = new MapSpecification();

spec.DataSourceName="MapPoint.NA";
spec.Views=views;
spec.Options=options;
spec.Pushpins=myPushPins;

render = new RenderServiceSoap();
render.Credentials = new System.Net.NetworkCredential(User,Pass);
render.PreAuthenticate=true;

MapImage[] mapImgs;
mapImgs = render.GetMap(spec);
Bitmap bMap = new Bitmap(new System.IO.MemoryStream(mapImgs[0].MimeData.Bits));
						
pictureMapPoint.Image=bMap;
The problem is in this line
Bitmap bMap = new Bitmap(new System.IO.MemoryStream(mapImgs[0].MimeData.Bits));

Thank you.. I already send you the code by mail.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 05-25-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

If you have a null exception in the bitmap line, then I assume render.GetMap(spec); did not return an array, so you have always to do a check if it is uncertain what the function return. in this case something like this you should code:

Code:
            if (mapImgs != null && mapImgs.Length > 0)
                Bitmap bMap = new Bitmap(new System.IO.MemoryStream(mapImgs[0].MimeData.Bits));
I got your mail but I cannot compile it as it contains many things I dont have. sorry.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 01-28-2006
Junior Member
White Belt
 
Join Date: Jan 2006
Posts: 2
I am having the exact same problem and i will provide more information. I ported the RouteMap.cs asp.net sample from the quickstarts in the MapPoint SDK. Everything works find and it uses the web service and returns route information (i can print the list of directions between two points). What happens is the RenderMap() call does in fact return a MapImage[] object (in my case always with one item in the array).
This one item contains everything needed to render the map With the exception of ANY MIME DATA OR a URL (depending on the return type i have selected). I have ran this as well on a desktop and it works, it just seems that the RenderMap function will not return either a Url or an actual image.

I am new to this but am fairly experienced with C# programming and am totally lost. I keep going over my code trying to find some issue with the MapSpecification object im passing, but nothign is wrong.

Here is some information about the object im passing and the object im getting:

please not this is a small portion of the code, the route has already been calculated and the map address is assigned prior to this.

Code:
	//Set up the map options
					MapOptions myMapOptions = new MapOptions();
					myMapOptions.ReturnType = MapReturnType.ReturnImage; 
					myMapOptions.Format = new ImageFormat();
					myMapOptions.Format.Height = 500;
					myMapOptions.Format.Width = 500;

					//Set up the specification object
					ViewByBoundingRectangle[] myMapViews = new ViewByBoundingRectangle[1];
					myMapViews[0] = myRoute.Itinerary.View.ByBoundingRectangle;

					MapSpecification mapSpec = new MapSpecification();
					mapSpec.Views = myMapViews;
					mapSpec.Options = myMapOptions;
					mapSpec.DataSourceName = "MapPoint.NA";
					mapSpec.Pushpins = myPushPins;
					mapSpec.Route = myRoute;
That sets up the options and specification object

Here is the only Item in the Map Array that is returned, as you can see there is 3 hotspots, but no MimeData (as there should be because the return type is image):

Any Ideas?!?!?
thanks


System.Object {mcMapper.net.mappoint.MapImage} System.Object
+ HotAreas {Length=3}

- [0] {mcMapper.net.mappoint.HotArea} mcMapper.net.mappoint.HotArea
System.Object {mcMapper.net.mappoint.HotArea} System.Object
IconRectangle <undefined value> mcMapper.net.mappoint.PixelRectangle
LabelRectangle <undefined value> mcMapper.net.mappoint.PixelRectangle
PinID null string
- [1] {mcMapper.net.mappoint.HotArea} mcMapper.net.mappoint.HotArea
System.Object {mcMapper.net.mappoint.HotArea} System.Object
IconRectangle <undefined value> mcMapper.net.mappoint.PixelRectangle
LabelRectangle <undefined value> mcMapper.net.mappoint.PixelRectangle
PinID null string
- [2] {mcMapper.net.mappoint.HotArea} mcMapper.net.mappoint.HotArea
System.Object {mcMapper.net.mappoint.HotArea} System.Object
IconRectangle <undefined value> mcMapper.net.mappoint.PixelRectangle
LabelRectangle <undefined value> mcMapper.net.mappoint.PixelRectangle
PinID null string


mcMapper.net.mappoint.HotArea[]
MimeData <undefined value> mcMapper.net.mappoint.MimeData
Url null string
View <undefined value> mcMapper.net.mappoint.MapViewRepresentations
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 01-29-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

I cannot find MapOptions or MapSpecification. Where can I find it ? Is this Mappoint or something from the pocket application ?
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
application, exceptionpokect, getmapspec


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
OutOfMemory Exception Gianmaria MapPoint 2006/2009 Discussion 1 01-24-2006 01:26 PM
Regarding COM exception at the end of execution... Anonymous MP2K Magazine Articles 0 05-12-2005 01:23 PM
Recordset exception. What am I doing wrong? Anonymous MapPoint 2006/2009 Discussion 3 01-25-2005 03:26 PM
AddPushPin() throws exception in VC++ radboudp MapPoint 2006/2009 Discussion 2 01-20-2005 07:49 PM
GetMap time sbedin MapPoint Web Service and Virtual Earth 1 01-12-2005 11:41 AM


All times are GMT -5. The time now is 11:02 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 55