Ignore:
Timestamp:
Jan 30, 2007, 5:20:08 PM (18 years ago)
Author:
duncan
Message:

fix up bug that was getting x and y round the wrong way in geospatial when lats and longs were used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/geospatial_data/geospatial_data.py

    r4195 r4199  
    1616   
    1717from anuga.utilities.numerical_tools import ensure_numeric
    18 from anuga.coordinate_transforms.geo_reference import Geo_reference, TitleError
     18
     19from anuga.coordinate_transforms.lat_long_UTM_conversion import UTMtoLL
     20from anuga.coordinate_transforms.geo_reference import Geo_reference, \
     21     TitleError, DEFAULT_ZONE
    1922from anuga.coordinate_transforms.redfearn import convert_from_latlon_to_utm
    2023from anuga.utilities.anuga_exceptions import ANUGAError
     
    332335        return self.geo_reference
    333336       
    334     def get_data_points(self, absolute=True, geo_reference=None):
    335         """Get coordinates for all data points as an Nx2 array
     337    def get_data_points(self, absolute=True, geo_reference=None,
     338                        as_lat_long=False):
     339        """Get coordinates for all data points as an Nx2 array.
     340        Column 0 is x values
     341        Column 1 is y values
    336342
    337343        If absolute is False returned coordinates are relative to the
     
    344350        Default: absolute is True.
    345351        """
    346 
     352        if as_lat_long is True:
     353            msg = "Points need a zone to be converted into lats and longs"
     354            assert self.geo_reference is not None, msg
     355            zone = self.geo_reference.get_zone()
     356            assert self.geo_reference.get_zone() is not DEFAULT_ZONE, msg
     357            lats_longs = []
     358            for point in self.get_data_points(True):
     359                ### UTMtoLL(northing, easting, zone,
     360                print "point[0]",point[0]
     361                print "point[1]",point[1]
     362                print "zone",zone
     363                results = UTMtoLL(point[0],point[1], zone)
     364                print "results", results
     365                lat_calced, long_calced = UTMtoLL(point[0],point[1], zone)
     366                print "lat_calced", lat_calced
     367                print "long_calced", long_calced
     368                lats_longs.append(UTMtoLL(point[0],point[1], zone))
     369           
     370           
    347371        if absolute is True and geo_reference is None:
    348372            return self.geo_reference.get_absolute(self.data_points)
     
    353377        else:
    354378            return self.data_points
    355        
    356379   
    357380    def get_attributes(self, attribute_name=None):
Note: See TracChangeset for help on using the changeset viewer.