Hello everybody,<br><br>I am new to mapguide. I am writing a java thick client map application using MapGuide Open Source as map server. I query images from the map server, this part works pretty well, not fast enought tough.<br>
<br>My problem is that I also need to be able to read the feature data in order to be able to provide some simplified geocoding service as well, but I can't get the feature reader to work, I also need the tile service because rendering images takes a lot of time and even implementing tile caching in the program is not enough, so I would like to use MapGuide's tile service as well reading tile data through MgByteReader in a similar way as reading arbitrary sized images.<br>
<br>I have problem running even the simplest sample codes, eg. map.Open() function throws an exception so I have to use map.Create() to open a map and I am thinking that this might be the root of my problems. <br><br>Here is how my code works: (simplified) I have followed instruction from the GettingStartedGuide.pdf to the letter when installing the MapGuide server<br>
<br>try {<br> MapGuideJavaApi.MgInitializeWebTier("C:\\webconfig.ini");<br> MgUserInformation userInfo = new MgUserInformation("Anonymous", "");<br> mapDefid = new MgResourceIdentifier(<br>
"Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");<br> MgSite site = new MgSite();<br> site.Open(userInfo);<br> String sessionId = site.CreateSession();<br>
site.Close();<br> MgSiteConnection siteConnection = new MgSiteConnection();<br> siteConnection.Open(userInfo);<br> MgResourceService service = (MgResourceService) siteConnection<br>
.CreateService(MgServiceType.ResourceService);<br> MgMap map;<br> map = new MgMap();<br> MgRenderingService renderingService = (MgRenderingService) siteConnection<br> .CreateService(MgServiceType.RenderingService);<br>
MgFeatureService featureService = (MgFeatureService) siteConnection<br> .CreateService(MgServiceType.FeatureService);<br> MgTileService tileService = (MgTileService) siteConnection<br>
.CreateService(MgServiceType.TileService);<br> MgResourceService resourceService = (MgResourceService) siteConnection<br> .CreateService(MgServiceType.ResourceService);<br>
map.Create(resourceService, mapDefid, "MyMap");<br> /**<br> * Opening map throws exception<br> */<br> // map.Open(resourceService, "Sheboygan");<br>
MgResourceIdentifier districtsId = new MgResourceIdentifier(<br> "Library://Samples/Sheboygan/Data/VotingDistricts.FeatureSource");<br> /**<br> * Selecting features throws exception<br>
*/<br>// featureService.SelectFeatures(districtsId, "VotingDistricts",<br>// new MgFeatureQueryOptions(), "Sheboygan");<br> /**<br> * Reading a certain area of the map as an image file stream works fine<br>
*/<br> MgByteReader reader = this.mapGuideResourceManager<br> .getRenderingService().RenderMap(map,<br> this.mapGuideResourceManager.getSelection(), env,<br> (int) renderSpec.getImageSize().getWidth(),<br>
(int) renderSpec.getImageSize().getHeight(),<br> new MgColor((short) 0, (short) 0, (short) 0xff),<br> "JPG");<br> } catch (MgException ex) {<br> ex.printStackTrace();<br>
}<br><br>Any help or ideas would be appreciated, now I am stuck with the development because of these problems.<br><br>Thanks,<br><br>aron deak<br>