<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def measure(self,fromGeometry,toGeometry,measureOperation, geometryType="esriGeometryPoint",pixelSize=None,mosaicRule=None, linearUnit=None,angularUnit=None,areaUnit=None):
 """ The measure operation is performed on an image service resource. It lets a user measure distance, direction, area, perimeter, and height from an image service. The result of this operation includes the name of the raster dataset being used, sensor name, and measured values. The measure operation can be supported by image services from raster datasets and mosaic datasets. Spatial reference is required to perform basic measurement (distance, area, and so on). Sensor metadata (geodata transformation) needs to be present in the data source used by an image service to enable height measurement (for example, imagery with RPCs). The mosaic dataset or service needs to include DEM to perform 3D measure. Users can provide arguments to the measure operation as query parameters. Inputs: fromGeometry - A geometry that defines the "from" location of the measurement. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. In addition to the JSON structures, for points, you can specify the geometry with a simple comma-separated syntax. By default, the geometry is assumed to be in the spatial reference of the image service. You can specify a different spatial reference by using the JSON structure syntax for geometries. toGeometry - A geometry that defines the "to" location of the measurement. The type of geometry must be the same as fromGeometry. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. In addition to the JSON structures, for points, you can specify the geometry with a simple comma-separated syntax. By default, the geometry is assumed to be in the spatial reference of the image service. You can specify a different spatial reference by using the JSON structure syntax for geometries. geometryType - The type of geometry specified by the fromGeometry and toGeometry parameters. The geometry type can be a point, polygon, or envelope. The default geometry type is point. Values: esriGeometryPoint | esriGeometryPolygon | esriGeometryEnvelope measureOperation - Specifies the type of measure being performed. Values: esriMensurationPoint | esriMensurationDistanceAndAngle | esriMensurationAreaAndPerimeter | esriMensurationHeightFromBaseAndTop | esriMensurationHeightFromBaseAndTopShadow | esriMensurationHeightFromTopAndTopShadow | esriMensurationCentroid | esriMensurationPoint3D | esriMensurationDistanceAndAngle3D | esriMensurationAreaAndPerimeter3D | esriMensurationCentroid3D pixelSize - The pixel level (resolution) being measured. If pixel size is not specified, pixelSize will default to the base resolution of the image service. The raster at the specified pixel size in the mosaic dataset will be used for measurement. The structure of the pixelSize parameter is the same as the structure of the point object returned by the ArcGIS REST API. In addition to the JSON structure, you can specify the pixel size with a simple comma-separated syntax. mosaicRule - Specifies the mosaic rule when defining how individual images should be mosaicked. When a mosaic rule is not specified, the default mosaic rule of the image service will be used (as advertised in the root resource: defaultMosaicMethod, mosaicOperator, sortField, sortValue). The first visible image is used by measure. linearUnit - The linear unit in which height, length, or perimeters will be calculated. It can be any of the following esriUnits constant. If the unit is not specified, the default is esriMeters. The list of valid esriUnits constants include: esriInches | esriFeet | esriYards | esriMiles | esriNauticalMiles | esriMillimeters | esriCentimeters | esriDecimeters | esriMeters | esriKilometers angularUnit - The angular unit in which directions of line segments will be calculated. It can be one of the following esriDirectionUnits constants: esriDURadians | esriDUDecimalDegrees If the unit is not specified, the default is esriDUDecimalDegrees. areaUnit - The area unit in which areas of polygons will be calculated. It can be any esriAreaUnits constant. If the unit is not specified, the default is esriSquareMeters. The list of valid esriAreaUnits constants include: esriSquareInches | esriSquareFeet | esriSquareYards | esriAcres | esriSquareMiles | esriSquareMillimeters | esriSquareCentimeters | esriSquareDecimeters | esriSquareMeters | esriAres | esriHectares | esriSquareKilometers """


        url = self._url + "/measure"
        params = {
            "f" : "json",
            "fromGeometry" : fromGeometry,
            "toGeometry": toGeometry,
            "geometryType": geometryType,
            "measureOperation": measureOperation
            }

        if not pixelSize is None:
            params["pixelSize"] = pixelSize
        if not mosaicRule is None:
            params["mosaicRule"] = mosaicRule
        if not linearUnit is None:
            params["linearUnit"] = linearUnit
        if not angularUnit is None:
            params["angularUnit"] = angularUnit
        if not areaUnit is None:
            params["areaUnit"] = areaUnit

        return self._get(url=url,
                         param_dict=params,
                         securityHandler=self._securityHandler,
                         proxy_url=self._proxy_url,
                         proxy_port=self._proxy_port)