[mapguide-users] How to programmatically migrate Unmanaged SHP to Managed SHP?

Zac Spitzer zac.spitzer at gmail.com
Sat Oct 6 06:30:12 PDT 2012


check the php source for the mapadmin

On Sat, Oct 6, 2012 at 7:22 PM, everling <tceverling at yahoo.co.uk> wrote:
> I have several hundred SHP files that needs to be migrated from their current
> Unmanaged state to a Managed state, and in the process programmatically
> alter the LayerDefinitions to point to their new locations. Unless I am
> mistaken, neither MapGuide Studio nor Maestro can do this, so I have been
> researching the MapGuide API.
>
> The MgResourceService and the MgByteSource class does provide most of the
> interfaces needed to do the job. I am able to retrieve a list of aliased SHP
> file paths to be migrated and I am able to store SHP files into a managed
> SHP FeatureSource. However, unless I am again mistaken, the MgByteSource is
> unable to process the aliased paths like '[Alias1]/example.shp'. It works
> fine if I give it an absolute path like 'C:\SHP\example.shp' but it doesn't
> with an aliased path.
>
> Assuming that this was intended, is there an officially blessed method to
> properly resolve the paths? I have been unable to find any API method that
> will do it. There was however a tantalising hint of it in the MapGuide RFC 2
> ( http://trac.osgeo.org/mapguide/wiki/MapGuideRfc2 ) under
> "MgResourceService::EnumerateUnmanagedDataMappings()", but this method is
> neither present in the current API documentation and attempting to call it
> regardless will throw an undefined method exception.
>
> A workaround this problem is by reading the necessary mappings by examining
> the serverconfig.ini file, but there doesn't seem to be any method to
> guarantee that I am looking at the correct serverconfig.ini file (unless the
> correct path is hard coded in), especially on servers with multiple versions
> of MapGuide/MapServer. Or is going by the webconfig.ini sufficient
> guarantee?
>
> Or maybe there is an alternative method of handling this that I am not aware
> of? As far as I can tell, the MgResourceService::GetResourceData is only
> intended for Managed feature sources, leaving me stuck with the
> MgByteSource.
>
> Thank you all for your time.
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-programmatically-migrate-Unmanaged-SHP-to-Managed-SHP-tp5006820.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users



-- 
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
+61 405 847 168


More information about the mapguide-users mailing list