[mapguide-users] featurereader, tileservice, map.open() problem
Kenneth, GEOGRAF A/S
ks at geograf.dk
Wed Mar 12 05:07:07 EDT 2008
When the viewer starts up, it does the following:
1. Create a new session. This implies creating a temporary empty repository
2. "Compile" information from the Library respository, regarding the map
(such as feature source names, etc) into a binary format.
3. Store this binary version in the session repository, at the root,
using the MapDefintion name as the name.
4. Display the map.
When you start by calling the "CreateSession()", you redo step 1, and
thus have no runtime map.
When you call "map.Create()", you replicate step 2 and 3.
This makes the two maps decoupled, and thus any changes to one is not
visible in the other.
You must login using the SessionID, obtained from the viewer, not with
username/password.
As for naming, it usually creates a bit of confusion.
If you MapDefinition has the path
Library://myfolder1/myfolder2/MyMap.MapDefinition, it becomes
Session:<session-id>//MyMap.Map.
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.
As for the feature reader, you might have to prefix the schema with the
schema name, like "SDF_2:Voting".
Regards, Kenneth, GEOGRAF A/S
Áron Deák skrev:
> Hello everybody,
>
> 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.
>
> 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.
>
> 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.
>
> Here is how my code works: (simplified) I have followed instruction
> from the GettingStartedGuide.pdf to the letter when installing the
> MapGuide server
>
> try {
> MapGuideJavaApi.MgInitializeWeb
> Tier("C:\\webconfig.ini");
> MgUserInformation userInfo = new
> MgUserInformation("Anonymous", "");
> mapDefid = new MgResourceIdentifier(
> "Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
> MgSite site = new MgSite();
> site.Open(userInfo);
> String sessionId = site.CreateSession();
> site.Close();
> MgSiteConnection siteConnection = new MgSiteConnection();
> siteConnection.Open(userInfo);
> MgResourceService service = (MgResourceService) siteConnection
> .CreateService(MgServiceType.ResourceService);
> MgMap map;
> map = new MgMap();
> MgRenderingService renderingService = (MgRenderingService)
> siteConnection
> .CreateService(MgServiceType.RenderingService);
> MgFeatureService featureService = (MgFeatureService)
> siteConnection
> .CreateService(MgServiceType.FeatureService);
> MgTileService tileService = (MgTileService) siteConnection
> .CreateService(MgServiceType.TileService);
> MgResourceService resourceService = (MgResourceService)
> siteConnection
> .CreateService(MgServiceType.ResourceService);
> map.Create(resourceService, mapDefid, "MyMap");
> /**
> * Opening map throws exception
> */
> // map.Open(resourceService, "Sheboygan");
> MgResourceIdentifier districtsId = new MgResourceIdentifier(
>
> "Library://Samples/Sheboygan/Data/VotingDistricts.FeatureSource");
> /**
> * Selecting features throws exception
> */
> // featureService.SelectFeatures(districtsId,
> "VotingDistricts",
> // new MgFeatureQueryOptions(), "Sheboygan");
> /**
> * Reading a certain area of the map as an image file
> stream works fine
> */
> MgByteReader reader = this.mapGuideResourceManager
> .getRenderingService().RenderMap(map,
> this.mapGuideResourceManager.getSelection(), env,
> (int) renderSpec.getImageSize().getWidth(),
> (int) renderSpec.getImageSize().getHeight(),
> new MgColor((short) 0, (short) 0, (short) 0xff),
> "JPG");
> } catch (MgException ex) {
> ex.printStackTrace();
> }
>
> Any help or ideas would be appreciated, now I am stuck with the
> development because of these problems.
>
> Thanks,
>
> aron deak
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080312/87127d12/attachment.html
More information about the mapguide-users
mailing list