Community of MapPoint and Virtual Earth Users and Developers
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 ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| GetMap(spec) Exception..Pokect Application 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 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?? |
| |||
| Re: GetMap(spec) Exception..Pokect Application
Hi, Eahter render or spec is probably null. Can you not check with debugger ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi, please show the code you use in GetMap(). probalbly the problem is in there.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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; Bitmap bMap = new Bitmap(new System.IO.MemoryStream(mapImgs[0].MimeData.Bits)); Thank you.. I already send you the code by mail. |
| |||
|
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));
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
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; 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 |
| |||
|
Hi, I cannot find MapOptions or MapSpecification. Where can I find it ? Is this Mappoint or something from the pocket application ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| application, exceptionpokect, getmapspec |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OutOfMemory Exception | Gianmaria | MapPoint 2006/2009 Discussion | 1 | 01-24-2006 12:26 PM |
| Regarding COM exception at the end of execution... | Anonymous | MP2K Magazine Articles | 0 | 05-12-2005 12:23 PM |
| Recordset exception. What am I doing wrong? | Anonymous | MapPoint 2006/2009 Discussion | 3 | 01-25-2005 02:26 PM |
| AddPushPin() throws exception in VC++ | radboudp | MapPoint 2006/2009 Discussion | 2 | 01-20-2005 06:49 PM |
| GetMap time | sbedin | MapPoint Web Service and Virtual Earth | 1 | 01-12-2005 10:41 AM |
Bodrum Holiday
Check out the picturesque towns on your Bodrum holiday... Book through UlookUbook!