<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
When the viewer starts up, it does the following:<br>
1. Create a new session. This implies creating a temporary empty
repository<br>
2. "Compile" information from the Library respository, regarding the
map (such as feature source names, etc) into a binary format.<br>
3. Store this binary version in the session repository, at the root,
using the MapDefintion name as the name.<br>
4. Display the map.<br>
<br>
When you start by calling the "CreateSession()", you redo step 1, and
thus have no runtime map.<br>
When you call "map.Create()", you replicate step 2 and 3.<br>
<br>
This makes the two maps decoupled, and thus any changes to one is not
visible in the other.<br>
<br>
You must login using the SessionID, obtained from the viewer, not with
username/password.<br>
As for naming, it usually creates a bit of confusion.<br>
If you MapDefinition has the path
Library://myfolder1/myfolder2/MyMap.MapDefinition, it becomes
Session:<session-id>//MyMap.Map.<br>
If you need to modify a layer, you can copy it into the session
repository, and change the runtime map to point at the session path
instead.<br>
<br>
As for the feature reader, you might have to prefix the schema with the
schema name, like "SDF_2:Voting".<br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth, GEOGRAF A/S
</pre>
<br>
<br>
Áron Deák skrev:
<blockquote
cite="mid:77dfe0ec0803110929k3a317290u670e8f38b58bbe81@mail.gmail.com"
type="cite">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.MgInitializeWeb
<div id="1g3y" class="ArwC7c ckChnd">Tier("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</div>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre>
</blockquote>
</body>
</html>