mapscript API shapfileObj units

Steve Lime Steve.Lime at DNR.STATE.MN.US
Mon Oct 30 10:27:00 PST 2006


There must be a .prj file accompanying the shapefile? MapScript has no
way to get at that
although a script could certainly copy that file to the name of the
output file for consistency.

Steve

>>> "Kralidis,Tom [Burlington]" <Tom.Kralidis at EC.GC.CA> 10/30/2006
12:17:58 PM >>>
Thanks for the info.

Having said this, if I do an ogrinfo, for example, on a shapefile, I
do
get some units info returned, i.e.:

$ ogrinfo -al -summary
~tkralidi/geos/data/Confederation_Trail_2005.shp
INFO: Open of `/home/tkralidi/geos/data/Confederation_Trail_2005.shp'
using driver `ESRI Shapefile' successful.

Layer name: Confederation_Trail_2005
Geometry: Line String
Feature Count: 601
Extent: (305059.000053, 657304.420162) - (471874.599925,
767349.092887)
Layer SRS WKT:
PROJCS["PEI NAD83",
    GEOGCS["GCS_North_American_1983_CSRS98",
        DATUM["NAD83_Canadian_Spatial_Reference_System",
            SPHEROID["GRS_1980",6378137.0,298.257222101]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Double_Stereographic"],
    PARAMETER["False_Easting",400000.0],
    PARAMETER["False_Northing",800000.0],
    PARAMETER["Central_Meridian",-63.0],
    PARAMETER["Scale_Factor",0.999912],
    PARAMETER["Latitude_Of_Origin",47.25],
    UNIT["Meter",1.0]]
NAME: String (12.0)
INDEX: String (12.0)
</snip>

...so I initially imagine that this could be marshalled into
shapefileObj.

..Tom

 

> -----Original Message-----
> From: Stephen Woodbridge [mailto:woodbri at swoodbridge.com] 
> Sent: 30 October, 2006 1:14 PM
> To: Kralidis,Tom [Burlington]
> Cc: MAPSERVER-USERS at LISTS.UMN.EDU 
> Subject: Re: [UMN_MAPSERVER-USERS] mapscript API shapfileObj units
> 
> You can't! This is because it is not encoded in the shapefile 
> to start with. The only reason you can get it from the Layer 
> pbject is because you can set it in the mapfile and then 
> retrieve it layer into mapscript. 
> The equivalent behavior would be to create a metadata file 
> for each shapefile and fetch it from that.
> 
> -Steve
> 
> Kralidis,Tom [Burlington] wrote:
> > Hi,
> > 
> > We have a script which utilizes the new mapscript geos 
> functionality 
> > by applying a buffer to each shapeObj within a shapefileObj 
> to output 
> > a new dataset.
> > 
> > My question is I would like to know the units of shapefileObj (or 
> > shapeObj).
> > 
> > The mapscript API has layerObj->{units} as a property, but I am not

> > working within the layerObj context (i.e. I am not working on 
> > mapfiles, just datasets).
> > 
> > Any idea on how to fetch this info from the mapscript API without 
> > layerObj?  I've skimmed through 
> > http://mapserver.gis.umn.edu/docs/reference/mapscript/index_html as

> > part of my investigation, but didn't find anything else (or 
> course I 
> > may have glossed over something -- happens to me often!).
> > 
> > Thanks
> > 
> > ..Tom
> 
> 



More information about the MapServer-users mailing list