[mapguide-users] Regarding Shape file

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Wed Jul 22 08:03:57 EDT 2009


It looks right, but I think the FeatureName should be:
SHP_Schema:india_st

(I have not used the SHP provider though, so I may be wrong).

Try to see if the error log has any messages.
C:\Program Files\MapGuideOpenSource2.0\Server\Logs\error.log

For (1), you can use any folder you like, as long as the web app has 
write access,
and MapGuide has read access. I recommend using a folder that is only 
used for this purpose.

For step (9), did you remember to set the layer visible?

Regarding the %MG_DATA_FILE_PATH%:

When saving a FeatureSource with Studio or Maestro, the SHP file
can be uploaded to MapGuide (called "Managed" in Maestro).
Files are uploaded with the call SETRESOURCEDATA.
These files will be stored in a folder inside the Repository folders, eg:
C:\Program 
Files\MapGuideOpenSource2.0\Server\Repositories\Library\DataFiles\8b16416a-ffff-ffff-8000-02004c4f4f50\shape-file.shp

The number/character part is generated by MapGuide, and is not 
accessible, so
you cannot guess/predict what the folder name is.

To use files that are stored in this folder, the FeatureSource has the 
path %MG_DATA_FILE_PATH%,
which is then substituted to the correct folder name, when the provider 
attempts to open a connection.
This ensures that if you move or copy a FeatureSource (even with a MGP 
file), the path will be correctly
substituted.

You can also use this method if you call SETRESOURCEDATA after step 4, 
to upload the file.
(Remember to set the path in step 3 to %MG_DATA_FILE_PATH%).

If you only need to use the SHP file in the current session, this has 
the effect that
when the session expires, the file will be deleted automatically 
together with the FeatureSource.
(If you store the FeatureSource in the Session:// repo).

Regards, Kenneth Skovhede, GEOGRAF A/S



sathishpsk9 skrev:
> Hi kenneth ,
> About Shape File loading a have a few more doubts....
> 1) Upload the file to the desired server folder
>    which folder i have to use .... either Pakages folder or
> Repositories/Library/DataFile or can i write any folder of my wish 
>    I had wrote to D:\Library
> 2) Create a featuresource xml document (possibly from a template xml file)
> 3) Set the "filepath" or similar parameter to point to the SHP file that 
> was uploaded
>  i created features source and  set file path as shown below
>
>     <?xml version="1.0" encoding="utf-8"?>
> <FeatureSource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xsi:noNamespaceSchemaLocation="FeatureSource-1.0.0.xsd">
>   <Provider>OSGeo.SHP</Provider>
>   <Parameter>
>     <Name>DefaultFileLocation</Name>
>     <Value>D:\Library\india_st.shp</Value>
>   </Parameter>
>   <Parameter>
>     <Name>TemporaryFileLocation</Name>
>     <Value />
>   </Parameter>
> </FeatureSource>
>
> 4) Save the featuresource (likely in the session repo) 
>  save it Library://satish/shape.FeatureSource
>
> 5) Create a layerdefinition xml document (possibly from a template xml file)
> 6) Point to the featuresource created in (4)
> 7) Update the geometry and class info for the featuresource
>
>   created a layer definition and made it point to feature source as shown 
>
> <?xml version="1.0" encoding="utf-8"?>
> <LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xsi:noNamespaceSchemaLocation="LayerDefinition-1.1.0.xsd" version="1.1.0">
>   <VectorLayerDefinition>
>     <ResourceId>Library://satish/shape.FeatureSource</ResourceId>
>     <FeatureName>SHP_Schema:shape</FeatureName>
>     <FeatureNameType>FeatureClass</FeatureNameType>
>     <Filter />
>     <PropertyMapping>
>       <Name>FeatId</Name>
>       <Value>FeatId</Value>
>     </PropertyMapping>
>     <Geometry>Geometry</Geometry>
>     <Url />
>     <ToolTip />
>     <VectorScaleRange>
>       <PointTypeStyle>
>         <DisplayAsText>false</DisplayAsText>
>         <AllowOverpost>false</AllowOverpost>
>         <PointRule>
>           <LegendLabel />
>           <PointSymbolization2D>
>             <Mark>
>               <Unit>Points</Unit>
>               <SizeContext>DeviceUnits</SizeContext>
>               <SizeX>10</SizeX>
>               <SizeY>10</SizeY>
>               <Rotation>0</Rotation>
>               <MaintainAspect>true</MaintainAspect>
>               <InsertionPointX>0</InsertionPointX>
>               <InsertionPointY>0</InsertionPointY>
>               <Shape>Square</Shape>
>               <Fill>
>                 <FillPattern>Solid</FillPattern>
>                 <ForegroundColor>ff000000</ForegroundColor>
>                 <BackgroundColor>ffffffff</BackgroundColor>
>               </Fill>
>               <Edge>
>                 <LineStyle>Solid</LineStyle>
>                 <Thickness>1</Thickness>
>                 <Color>000000</Color>
>                 <Unit>Points</Unit>
>                 <SizeContext>DeviceUnits</SizeContext>
>               </Edge>
>             </Mark>
>           </PointSymbolization2D>
>         </PointRule>
>       </PointTypeStyle>
>       <LineTypeStyle>
>         <LineRule>
>           <LegendLabel />
>           <LineSymbolization2D>
>             <LineStyle>Solid</LineStyle>
>             <Thickness>1</Thickness>
>             <Color>000000</Color>
>             <Unit>Points</Unit>
>             <SizeContext>DeviceUnits</SizeContext>
>           </LineSymbolization2D>
>         </LineRule>
>       </LineTypeStyle>
>       <AreaTypeStyle>
>         <AreaRule>
>           <LegendLabel>ILOT</LegendLabel>
>           <AreaSymbolization2D>
>             <Fill>
>               <FillPattern>Solid</FillPattern>
>               <ForegroundColor>ff00ffff</ForegroundColor>
>               <BackgroundColor>ffffffff</BackgroundColor>
>             </Fill>
>             <Stroke>
>               <LineStyle>Solid</LineStyle>
>               <Thickness>1</Thickness>
>               <Color>000000</Color>
>               <Unit>Points</Unit>
>               <SizeContext>DeviceUnits</SizeContext>
>             </Stroke>
>           </AreaSymbolization2D>
>         </AreaRule>
>       </AreaTypeStyle>
>     </VectorScaleRange>
>   </VectorLayerDefinition>
> </LayerDefinition>
>
> 8) Save the layerdefinition (likely in the session repo)
>   save to Library repository 
>   Library://satish/shapelayer.LayerDefinition
>
> 9) Add the layer to the runtime map
>   added to run time map
>  map.GetLayers().Insert(0, mylayer);-- used this method to add
>
> 10) Save the runtime map- saved map
> 11) Refresh the client- refreshed client using layer.ForceRefresh() method .
> map not diplayed ..........
>
> Did i followed the steps correctly or i al missing something ?
> where does " %MG_DATA_FILE_PATH% "  this point to or indictes ?
> Please help  me 
>
>
> Thanking yoi in anticipation
> Satish Kumar
>
>
>
>
>   


More information about the mapguide-users mailing list