[mapguide-users] how to use FDO api into MAPGUIDE applications
Ivan Milicevic
Ivan.Milicevic at supranet.hr
Fri Feb 6 16:51:06 EST 2009
Stefan, thank's a lot for posted sample. It would be very helpful for
me.
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Stefan
Dalakov
Sent: Friday, February 06, 2009 9:57 PM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] how to use FDO api into MAPGUIDE
applications
Rodolfo,
I don't dare to oppose Andy, I believe there is a solid justification
behind his statements, but note that:
1. This post concerns the previous versions of MGOS and FDO (I do not
say that it makes difference, in fact I am not aware of changes from FDO
3.3.0 to 3.3.1)
2. Since Mapguide connects to data in an uniform manner - thru FDO, and
you are able to accomplish your task with SDF, then it depends only on
capabilities of the FDO provider if you will succeed with SHP or any
other format
I am sorry, if I have not been helpful to you
Ivan ,
I have used as a template the redlining module from PHPSAMPLES package.
Here is part of the code :
.........
$map = new MgMap();
$map->Open($resourceService, $mapName);
$mylayers = $map->GetLayers() ;
$mylayer = $mylayers->GetItem ($layerName);
$ftrclassname = $mylayer->GetFeatureClassName();
$batchPropertyCollection = new MgBatchPropertyCollection();
$propertyCollection = MakePoly($use,$plabel,$owner, $polydef);
$batchPropertyCollection->Add($propertyCollection);
$cmd = new MgInsertFeatures( $ftrclassname,
$batchPropertyCollection);
$featureCommandCollection = new MgFeatureCommandCollection();
$featureCommandCollection->Add($cmd);
$featureService->UpdateFeatures
($myResourceID,$featureCommandCollection,false);
.......
function MakePoly($puse,$pplabel,$powner,$polystring)
{
$propertyCollection = new MgPropertyCollection();
$ownerProperty = new MgStringProperty("Owner", $powner);
$propertyCollection->Add($ownerProperty);
$useProperty = new MgStringProperty("Purpose", $puse);
$propertyCollection->Add($useProperty);
$labelProperty = new MgStringProperty("Label", $pplabel);
$propertyCollection->Add($labelProperty);
$wktReaderWriter = new MgWktReaderWriter();
$agfReaderWriter = new MgAgfReaderWriter();
$agftext = $polystring ;
$geometry = $wktReaderWriter->Read( $agftext);
$geometryByteReader = $agfReaderWriter->Write($geometry);
$geometryProperty = new MgGeometryProperty("Geometry",
$geometryByteReader);
$propertyCollection->Add($geometryProperty);
return $propertyCollection;
}
The coordinate data in $polystring is formatted according to the grammar
described in
http://mapguide.osgeo.org/files/mapguide/docs/2.0/da/dc0/group___agf_tex
t.htm
Best regards : Stefan
Rodolfo Moreno wrote:
Hi Stefan, you can add and delete features using mapguide API, however
you
can't create non add fields to the SHPs.
http://n2.nabble.com/Writing-data-to-a-shapefile-example--td1815692.html
#a1815693
Ivan Milicevic wrote:
Hello,
Can you post some sample code for that?
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of
Stefan
Dalakov
Sent: Friday, February 06, 2009 6:20 PM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] how to use FDO api into MAPGUIDE
applications
For sure you can modify SHP files with Mapguide API - I have
application
which adds and deletes features.
I have not tried to create a SHP file, but I don't think it is
impossible
Stefan Dalakov
Rodolfo Moreno wrote:
I have read that only SDFs can be created and altered
with mapguide
API,
which is why I need to use FDO api in my mapguide
applications in
order to
create and alter SHPs.
If anyone has code sample or documentation about it, I
will be very
grateful.
Cheers,
-----
Rodolfo Moreno
CivilEng
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
-----
Rodolfo Moreno
CivilEng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090206/27823502/attachment.html
More information about the mapguide-users
mailing list