[mapguide-dev] area calculation conversion to meters

Paul Spencer pspencer at dmsolutions.ca
Mon Dec 4 11:06:15 EST 2006


Sweet, thanks Daniel.  Can you confirm something for me please?  In  
the sprintf, there is a zoneStr variable that appears to have no  
value and perhaps shouldn't be there?  As far as I can see, there are  
only two substitution points in the string and zoneStr shouldn't go  
in either one :)

Cheers

Paul

On 4-Dec-06, at 10:55 AM, Daniel Morissette wrote:

> Paul Spencer wrote:
>> over my head, for sure!  I don't think I need that kind of  
>> accuracy.  I would like to know if there is a programmatic way to  
>> determine a UTM coordinate system centered on a particular  
>> location or, as a minimum, a way to find the UTM zone that a given  
>> coordinate lies in.
>> Is there some base string I could use and just substitute in some  
>> values?
>
> The OGC WMS spec has projection AUTO:42001 that does that. There  
> used to be some background info including some code snippets  
> showing how to setup a UTM coordsys centered on a given location/ 
> zone at http://www.digitalearth.gov/wmt/auto.html but this page has  
> been taken down a little while ago.
>
> Thanks to the Web Archive, you can still find the info here:
> http://web.archive.org/web/20010430015937/http:// 
> www.digitalearth.gov/wmt/auto.html
>
> The block of code you're looking for is:
>
>         /** WGS 84 / Auto UTM **/
>         zone = floor( (lon0 + 180.0) / 6.0 ) + 1;
>         sprintf( wktStr, "PROJCS[\"WGS 84 / Auto UTM\",GEOGCS[\"WGS  
> 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_1984\", 
> 6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT 
> [\"Decimal_Degree\",0.0174532925199433]],PROJECTION 
> [\"Transverse_Mercator\"],PARAMETER[\"central_meridian\",%. 
> 16g],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"scale_factor\", 
> 0.9996],PARAMETER[\"false_easting\",500000],PARAMETER 
> [\"false_northing\",%.16g],UNIT[\"Meter\",1]]", zoneStr, -183.0 +  
> zone * 6.0, (lat0 >= 0.0) ? 0.0 : 10000000.0 );
>
>
> Daniel
> -- 
> Daniel Morissette
> http://www.mapgears.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe at mapguide.osgeo.org
> For additional commands, e-mail: dev-help at mapguide.osgeo.org
>

+-----------------------------------------------------------------+
|Paul Spencer                          pspencer at dmsolutions.ca    |
+-----------------------------------------------------------------+
|Chief Technology Officer                                         |
|DM Solutions Group Inc                http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+








More information about the Mapguide-internals mailing list