[mapguide-users] SQL query to load .SHP?

Jackie C. Ng jumpinjackie at gmail.com
Tue May 6 11:30:29 EDT 2008


You can create packages without Studio, but the data (shp files) must already
be in the site repository. I assume this is not the case.

When loading external data into a mapguide site, Studio does something
similar to this.

1) Calls SETRESOURCE on a given resource ID, with the xml content for a
Feature Source xml document. It uses the special variable
%MG_DATA_FILE_PATH% to indicate that the actual shp file is embedded with
the Feature Source. (eg. %MG_DATA_FILE_PATH%Test.shp ). A sample Feature
Source document would look like

<?xml version="1.0"?>
<FeatureSource xsi:noNamespaceSchemaLocation="FeatureSource-1.0.0.xsd">
    <Provider>OSGeo.SHP</Provider>
    <Parameter>
        <Name>DefaultFileLocation</Name>
        <Value>%MG_DATA_FILE_PATH%Test.shp</Value>
    </Parameter>
</FeatureSource>

2) Calls SETRESOURCEDATA on that same resource ID, uploading all parts of
the shp file. The resource name is the name of the uploaded file. So for an
example file Test.shp, the following files would be uploaded.

- Test.shp (name: Test.shp)
- Test.shx (name: Test.shx)
- Test.dbf (name: Test.dbf)
- Test.prj (name: Test.prj)
- other dependent files.

By using the mapagent test pages
(http://yourservername/mapguide/mapagent/index.html) you can do these steps
manually.

If you then call TESTCONNECTION on that feature source create in step 1, and
the test passes, you have a working feature source.

But you shouldn't really do this manually unless you really know each step
properly. 

If you need a Studio alternative, try MapStudio
http://code.google.com/p/mapstudioos

- Jackie


Viva_Rose wrote:
> 
> Hello,
> 
> Is there any solution to create mgp file without using the Studio. In my
> web application, i've to retrieve data from my postGres database to get
> field of 'the_geom' value using SQL command. By using the value of
> 'the_geom' field then i'll use to create a new .SHP file and store it in a
> specified folder. Is it any solution that i can use to automatically
> displayed/retrieve the .shp that i just created and convert it into mgp
> and load it into the map? I really hope someone can help me..
> 
> Really need help,
> Viva
> 


-----
http://themapguyde.blogspot.com

http://www.linkedin.com/in/jackieng
-- 
View this message in context: http://www.nabble.com/SQL-query-to-load-.SHP--tp17078860p17085775.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list