www.gusucode.com > map 案例源码 matlab代码程序 > map/WorkingInUTMWithoutAMapAxesExample.m
%% Working in UTM Without a Map Axes % You can set up UTM to calculate coordinates without generating a map % display, using the |defaultm| function. The |utmzone| and |utmgeoid| % functions help you select a zone and an appropriate ellipsoid. In this % example, you generate UTM coordinate data for a location in New York % City, using that point to define the projection itself. %% % Define a location in New York City. p1 = [40.7, -74.0]; %% % Obtain the UTM zone for this point. z1 = utmzone(p1) %% % Obtain the suggested ellipsoid vector and name for this zone. [ellipsoid,estr] = utmgeoid(z1) %% % Set up the UTM coordinate system based on this information. utmstruct = defaultm('utm'); utmstruct.zone = '18T'; utmstruct.geoid = ellipsoid; utmstruct = defaultm(utmstruct) %% % Calculate the grid coordinates, without a map display. [x,y] = mfwdtran(utmstruct,p1(1),p1(2)) %% % Compute the zone limits (latitude and longitude limits) for the zone name % returned previously, using the |utmzone| function. utmzone('18T') %% % Therefore, you can call |utmzone| recursively to obtain the limits of the % UTM zone within which a point location falls. [zonelats,zonelons] = utmzone(utmzone(40.7, -74.0))