[OSGeo-Discuss] [mapserver-dev] [discuss] featurereader,
tileservice, map.open() problem
David William Bitner
david.bitner at gmail.com
Tue Mar 11 13:29:40 EDT 2008
Aron -
You might want to try the MapGuide mailing list (MapServer is not the same
as MapGuide):
http://lists.osgeo.org/mailman/listinfo/mapguide-users
On Tue, Mar 11, 2008 at 11:20 AM, Áron Deák <deakaron at gmail.com> wrote:
> 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.MgInitializeWebTier("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
>
> _______________________________________________
> Discuss mailing list
> Discuss at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/discuss
>
>
--
************************************
David William Bitner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20080311/da2cd08b/attachment-0001.html
More information about the mapserver-dev
mailing list