示例#1
0
        public void GetCollectionAndCheck( double startingLat, double startingLong, int maxPoints, double offset,
            Dictionary<string, string> meta, BackendlessGeoQuery geoQuery)
        {
            int counter = maxPoints;
              if( geoQuery.Categories.Count == 0 && GetDefinedCategories() != null )
            geoQuery.Categories = GetDefinedCategories();

              BackendlessCollection<GeoPoint> geoPointBackendlessCollection = Backendless.Geo.GetPoints( geoQuery );
              Assert.IsNotNull( geoPointBackendlessCollection, "Server returned a null collection" );

              foreach( GeoPoint geoPoint in geoPointBackendlessCollection.GetCurrentPage() )
              {
            if( meta == null || meta.Count == 0 )
            {
              Assert.IsTrue( geoPoint.Metadata.Count == 0, "Server returned points with unexpected metadata" );
            }
            else
            {
              foreach( KeyValuePair<string, string> keyValuePair in meta )
              {
            Assert.IsTrue(geoPoint.Metadata.ContainsKey( keyValuePair.Key ), "Server returned points with unexpected metadata");
            Assert.IsTrue(geoPoint.Metadata[keyValuePair.Key].Equals(keyValuePair.Value), "Server returned points with unexpected metadata");
              }
            }

            Assert.AreEqual( startingLat, geoPoint.Latitude, 0.0000000001d,
                         "Server returned points from unexpected latitude range" );
            Assert.IsTrue( geoPoint.Longitude >= startingLong && geoPoint.Longitude <= (startingLong + offset),
                         "Server returned points from unexpected longtitude range" );

            counter--;
              }

              Assert.AreEqual( counter, 0, "Server found wrong total points count" );
        }
示例#2
0
    void GetPoints()
    {
        mWaiting.SetActive(true);

        List<string> categories = new List<string>();
        categories.Add("geoservice_sample");
        BackendlessGeoQuery query = new BackendlessGeoQuery(mLatitude, mLongitude, mRadius, Units.KILOMETERS, categories);

        AsyncCallback<BackendlessCollection<GeoPoint>> callback = new AsyncCallback<BackendlessCollection<GeoPoint>>(
          collection =>
          {
        mPoints = "";
        foreach (GeoPoint point in collection.GetCurrentPage())
        {
          mPoints += "City:" + point.Metadata["city"] + ", Lat:" + point.Latitude + ", Lon:" + point.Longitude + "\n";
        }
        mIsGetPointsFinish = true;
        mIsGetPointsSuccess = false;
          },
          fault =>
          {
        mResultMessage = "Error\n\nCode = " + fault.FaultCode + "\nmessage = " + fault.Message;
        mIsGetPointsFinish = true;
        mIsGetPointsSuccess = true;
          });

        Backendless.Geo.GetPoints(query, callback);
    }
示例#3
0
    public void TestGetPointsForRectangle()
    {
      RunAndAwait( () =>
        {
          double startingLat = 10;
          double startingLong = 10;
          int maxPoints = 10;
          SetDefinedCategory( GetRandomCategory() );
          Dictionary<String, String> meta = GetRandomSimpleMetadata();
          CountdownEvent latch = new CountdownEvent( maxPoints );

          for( int i = 0; i < maxPoints; i++ )
          {
            Backendless.Geo.SavePoint( startingLat, startingLong + i, GetDefinedCategories(), meta,
                                       new AsyncCallback<GeoPoint>( response => latch.Signal(), fault =>
                                         {
                                           for( int j = 0; j < latch.CurrentCount; j++ )
                                             latch.Signal();
                                         } ) );
          }
          latch.Wait();

          var geoQuery = new BackendlessGeoQuery( startingLat + 1, startingLong - 1, startingLat - 1,
                                                  startingLong + maxPoints + 1 );
          GetCollectionAndCheck( startingLat, startingLong, maxPoints, maxPoints, meta, geoQuery );
        } );
    }
示例#4
0
    public PointsPage()
    {
      InitializeComponent();

      _cityPointsList = new CityPointsList();
      _backendlessGeoQuery = new BackendlessGeoQuery();
      CityPointsDataGrid.DataContext = _cityPointsList;

      AsyncStartedEvent += () =>
      {
        ProgressBar.Visibility = Visibility.Visible;
      };
      AsyncFinishedEvent += () =>
      {
        ProgressBar.Visibility = Visibility.Collapsed;
      };
    }
示例#5
0
    public void TestGetPointsForRectangle()
    {
      double startingLat = 10;
      double startingLong = 10;
      int maxPoints = 10;
      SetDefinedCategory( GetRandomCategory() );
      Dictionary<string, string> meta = GetRandomSimpleMetadata();

      for( int i = 0; i < maxPoints; i++ )
      {
        Backendless.Geo.SavePoint( startingLat, startingLong + i, GetDefinedCategories(), meta );
      }

      BackendlessGeoQuery geoQuery = new BackendlessGeoQuery( startingLat + 1, startingLong - 1, startingLat - 1,
                                                              startingLong + maxPoints + 1 );
      GetCollectionAndCheck( startingLat, startingLong, maxPoints, maxPoints, meta, geoQuery );
    }
示例#6
0
    public void TestGetPointsWithBothRectAndRadiusQuery()
    {
      try
      {
        BackendlessGeoQuery geoQuery = new BackendlessGeoQuery( 10d, 10d, 20d, 20d );
        geoQuery.Radius = 10d;
        geoQuery.Latitude = 10d;
        geoQuery.Longitude = 10d;

        Backendless.Geo.GetPoints( geoQuery );

        Assert.Fail( "Client send a query with both rectangle and radius search query" );
      }
      catch( System.Exception e )
      {
        CheckErrorCode( ExceptionMessage.INCONSISTENT_GEO_QUERY, e );
      }
    }
示例#7
0
        public void TestGetPointsByRadiusIn100Yards()
        {
            double startingLat = 10;
              double startingLong = 30;
              int maxPoints = 10;
              double offset = 0;
              SetDefinedCategory( GetRandomCategory() );
              Dictionary<string, string> meta = GetRandomSimpleMetadata();

              for( int i = 0; i < maxPoints; i++ )
              {
            //offset += METER*0.914399998610112;
            offset += METER*0.914399;
            Backendless.Geo.SavePoint( startingLat, startingLong + offset, GetDefinedCategories(), meta );
              }

              BackendlessGeoQuery geoQuery = new BackendlessGeoQuery( startingLat, startingLong + offset/2, 100, Units.YARDS );
              GetCollectionAndCheck( startingLat, startingLong, maxPoints, offset, meta, geoQuery );
        }
示例#8
0
    public void GetPoints( BackendlessGeoQuery geoQuery, AsyncCallback<BackendlessCollection<GeoPoint>> callback )
    {
      try
      {
        checkGeoQuery( geoQuery );

        var responder = new AsyncCallback<BackendlessCollection<GeoPoint>>( r =>
          {
            r.Query = geoQuery;

            foreach( GeoPoint geoPoint in r.Data )
              if( geoPoint is GeoCluster )
                ( (GeoCluster) geoPoint ).GeoQuery = geoQuery;

            if( callback != null )
              callback.ResponseHandler.Invoke( r );
          }, f =>
            {
              if( callback != null )
                callback.ErrorHandler.Invoke( f );
              else
                throw new BackendlessException( f );
            } );

        Invoker.InvokeAsync( GEO_MANAGER_SERVER_ALIAS, "getPoints",
                             new Object[] { Backendless.AppId, Backendless.VersionNum, geoQuery }, responder );
      }
      catch( System.Exception ex )
      {
        if( callback != null )
          callback.ErrorHandler.Invoke( new BackendlessFault( ex ) );
        else
          throw;
      }
    }
示例#9
0
    public BackendlessCollection<SearchMatchesResult> RelativeFind( BackendlessGeoQuery geoQuery )
    {
      if( geoQuery == null )
        throw new ArgumentNullException( ExceptionMessage.NULL_GEO_QUERY );

      if( geoQuery.RelativeFindMetadata.Count == 0 || geoQuery.RelativeFindPercentThreshold == 0 )
        throw new ArgumentException( ExceptionMessage.INCONSISTENT_GEO_RELATIVE );

      var result = Invoker.InvokeSync<BackendlessCollection<SearchMatchesResult>>( GEO_MANAGER_SERVER_ALIAS, "relativeFind",
                                                                        new Object[]
                                                                          {
                                                                            Backendless.AppId, Backendless.VersionNum,
                                                                            geoQuery
                                                                          } );

      result.Query = geoQuery;

      return result;
    }
示例#10
0
    public void GetPoints( String geofenceName, BackendlessGeoQuery query, AsyncCallback<BackendlessCollection<GeoPoint>> callback )
    {
      checkGeoQuery( query );
      Object[] args = new Object[] { Backendless.AppId, Backendless.VersionNum, geofenceName, query };
      var responder = new AsyncCallback<BackendlessCollection<GeoPoint>>( r =>
          {
            r.Query = query;

            if( callback != null )
              callback.ResponseHandler.Invoke( r );
          }, f =>
          {
            if( callback != null )
              callback.ErrorHandler.Invoke( f );
            else
              throw new BackendlessException( f );
          } );
      Invoker.InvokeAsync( GEO_MANAGER_SERVER_ALIAS, "getPoints", args, responder );
    }
示例#11
0
    public BackendlessCollection<GeoPoint> GetPoints( BackendlessGeoQuery geoQuery )
    {
      checkGeoQuery( geoQuery );
      Object[] methodArgs = new Object[] { Backendless.AppId, Backendless.VersionNum, geoQuery };
      BackendlessCollection<GeoPoint> result = Invoker.InvokeSync<BackendlessCollection<GeoPoint>>( GEO_MANAGER_SERVER_ALIAS, "getPoints", methodArgs );
      result.Query = geoQuery;

      foreach( GeoPoint geoPoint in result.Data )
        if( geoPoint is GeoCluster )
          ( (GeoCluster) geoPoint ).GeoQuery = geoQuery;

      return result;
    }
示例#12
0
        public void SearchPointsInMetadataTest()
        {
            
            try
            {
                double latitude = 1.23;
                double longitude = 2.36;
                Dictionary<string, string> metadata = new Dictionary<string, string>();
                metadata.Add("A", "aaa");
                target.AddPoint(latitude, longitude, metadata);
                BackendlessGeoQuery query = new BackendlessGeoQuery(metadata);
                query.Radius = 20;
                query.Units = Units.METERS;
                var result = target.GetPoints(query);
                Assert.IsNotNull(result);
            }
            catch (BackendlessException e)
            {
                Assert.Fail(e.Message);
            }

        }
示例#13
0
        public void GetPointsForRectCategoriesTest()
        {
            try
            {
                for (int i = 1; i <= 10; i++)
                {
                    double nwlat = 80.01 - 0.00001 * i;
                    double nwlon = 60.01 + 0.00001 * i;
                    Dictionary<string, string> metadata = new Dictionary<string, string> ();
                    metadata.Add("TEST", "test" + i);
                    target.AddPoint(nwlat,nwlon,metadata);
                }
                BackendlessGeoQuery geoQuery = new BackendlessGeoQuery(80.01, 60.01, 60.01, 80.01);
                var result = target.GetPoints(geoQuery);
                Assert.IsNotNull(result);
            }
            catch (BackendlessException ex)
            {
                Assert.AreEqual("N/A", ex.Code);
            }

        }
示例#14
0
        public void SearchPointsWithWrongLongitudeTest()
        {

            try
            {
                BackendlessGeoQuery geoQuery = new BackendlessGeoQuery();
                geoQuery.Latitude = 90;
                geoQuery.Longitude = 181;
                geoQuery.Radius = 20;
                geoQuery.Units = Units.METERS;
                target.GetPoints(geoQuery);
            }
            catch (BackendlessException e)
            {
                Assert.AreEqual("N/A", e.Code);
            }
        }
示例#15
0
    public void TestGetPointsWithoutMetadata()
    {
      double startingLat = 50;
      double startingLong = 10;
      int maxPoints = 10;
      Dictionary<string, string> meta = GetRandomSimpleMetadata();
      SetDefinedCategory( GetRandomCategory() );

      for( int i = 0; i < maxPoints; i++ )
      {
        Backendless.Geo.SavePoint( startingLat, startingLong + i, GetDefinedCategories(), meta );
      }

      meta = null;
      BackendlessGeoQuery geoQuery = new BackendlessGeoQuery( GetDefinedCategories() );
      geoQuery.IncludeMeta = false;

      GetCollectionAndCheck( startingLat, startingLong, maxPoints, maxPoints, meta, geoQuery );
    }
示例#16
0
        public void SearchPointsInMultipleCategoriesTest()
        {
            try
            {
                Dictionary<string,string> dict=new Dictionary<string,string>();
                dict.Add("Test","Test");
                List<string> cateName=new List<string>{"cateName1","cateName2"};
                //var point=target.AddPoint(2.22,3.33,cateName,dict);
                BackendlessGeoQuery query = new BackendlessGeoQuery();
                query.Categories = cateName;
                query.Radius = 20;
                query.Units = Units.METERS;
                query.PageSize = 5;
                query.Offset = 0;
                var result=target.GetPoints(query);
                Assert.IsNotNull(result);
            }
            catch(BackendlessException ex)
            {
                Assert.Fail(ex.Message);
            }

        }
示例#17
0
 public void GetPointsForRectangleAndRadiusTest()
 {
     try
     {
         BackendlessGeoQuery geoQuery = new BackendlessGeoQuery(80.01, 60.01, 60.01, 80.01);
         geoQuery.Radius = 20;
         geoQuery.Units = Units.METERS;
         geoQuery.PageSize = 2;
         geoQuery.Offset = 1;
         var result = target.GetPoints(geoQuery);
         Assert.IsNotNull(result);
     }
     catch (BackendlessException ex)
     {
         Assert.AreEqual("N/A", ex.Code);
     }
 }
示例#18
0
        public void SearchPointsIncludemetadataWithNegativeOffsetTest()
        {
            
            try
            {
                BackendlessGeoQuery geoQuery = new BackendlessGeoQuery();
                geoQuery.IncludeMeta = false;
                geoQuery.Latitude = 60.01;
                geoQuery.Longitude = 60.01;
                geoQuery.Radius = 20;
                geoQuery.PageSize = 2;
                geoQuery.Offset = 0;
                geoQuery.Units = Units.METERS;
                var result = target.GetPoints(geoQuery);
                Assert.IsNotNull(result);
            }
            catch (BackendlessException e)
            {
                Assert.Fail(e.Message);
            }

        }
示例#19
0
 public void searchPointsInDefaultCategoryWithOffsetGreaterThanMaxPointTest()
 {
     try
     {
         double lon = 10  * METERS;
         Dictionary<string, string> metadata = new Dictionary<string, string>();
         metadata.Add("A", "aaa");
         metadata.Add("B", "bbb");
         for (int i = 0; i < 14; i++)
         {
             double lat = i * METERS;
             target.AddPoint(lat, lon, metadata);
         }
         BackendlessGeoQuery geoQuery = new BackendlessGeoQuery(5  * METERS, 5 * METERS, 10, Units.MILES);
         geoQuery.PageSize = 1;
         geoQuery.Offset = 15;
         var result = target.GetPoints(geoQuery);
         Assert.IsNotNull(result);
     }
     catch (BackendlessException ex)
     {
         Assert.AreEqual("4003", ex.Code);
     }
 }
示例#20
0
 public void SearchPointsInDefaultCategoryWithNegativeOffsetTest()
 {
     try
     {
         BackendlessGeoQuery geoQuery = new BackendlessGeoQuery(60.01, 60.01, 2, -1);
         geoQuery.Radius = 20;
         geoQuery.Units = Units.METERS;
         target.GetPoints(geoQuery);
     }
     catch (BackendlessException ex)
     {
         Assert.AreEqual("N/A", ex.Code);
     }
 }
示例#21
0
    public void RelativeFind( BackendlessGeoQuery geoQuery, AsyncCallback<BackendlessCollection<SearchMatchesResult>> callback )
    {
      try
      {
        if( geoQuery == null )
          throw new ArgumentNullException( ExceptionMessage.NULL_GEO_QUERY );

        if( geoQuery.RelativeFindMetadata.Count == 0 || geoQuery.RelativeFindPercentThreshold == 0 )
          throw new ArgumentException( ExceptionMessage.INCONSISTENT_GEO_RELATIVE );

        var responder = new AsyncCallback<BackendlessCollection<SearchMatchesResult>>( r =>
        {
          r.Query = geoQuery;

          if( callback != null )
            callback.ResponseHandler.Invoke( r );
        }, f =>
        {
          if( callback != null )
            callback.ErrorHandler.Invoke( f );
          else
            throw new BackendlessException( f );
        } );

        Invoker.InvokeAsync( GEO_MANAGER_SERVER_ALIAS, "relativeFind",
                             new Object[] { Backendless.AppId, Backendless.VersionNum, geoQuery }, responder );
      }
      catch( System.Exception ex )
      {
        if( callback != null )
          callback.ErrorHandler.Invoke( new BackendlessFault( ex ) );
        else
          throw;
      }
    }
示例#22
0
    public void TestGetPointsWithOffsetGreaterThenPointsCount()
    {
      double startingLat = 60;
      double startingLong = 10;
      int maxPoints = 10;
      SetDefinedCategory( GetRandomCategory() );
      Dictionary<string, string> meta = GetRandomSimpleMetadata();

      for( int i = 0; i < maxPoints; i++ )
      {
        Backendless.Geo.SavePoint( startingLat, startingLong + i, GetDefinedCategories(), meta );
      }

      BackendlessGeoQuery geoQuery = new BackendlessGeoQuery( GetDefinedCategories() );
      geoQuery.Offset = maxPoints*2;

      try
      {
        Backendless.Geo.GetPoints( geoQuery );
        Assert.Fail( "Server accepted request" );
      }
      catch( System.Exception e )
      {
        CheckErrorCode( 4003, e );
      }
    }
示例#23
0
    private void checkGeoQuery( BackendlessGeoQuery geoQuery )
    {
      if( geoQuery == null )
        throw new ArgumentNullException( ExceptionMessage.NULL_GEO_QUERY );

      if( geoQuery.SearchRectangle != null )
      {
        if( geoQuery.SearchRectangle.Length != 4 )
          throw new ArgumentException( ExceptionMessage.WRONG_SEARCH_RECTANGLE_QUERY );

        if( !Double.IsNaN( geoQuery.Radius ) )
          throw new ArgumentException( ExceptionMessage.INCONSISTENT_GEO_QUERY );

        if( !Double.IsNaN( geoQuery.Latitude ) )
          throw new ArgumentException( ExceptionMessage.INCONSISTENT_GEO_QUERY );

        if( !Double.IsNaN( geoQuery.Longitude ) )
          throw new ArgumentException( ExceptionMessage.INCONSISTENT_GEO_QUERY );
      }
      else if( !Double.IsNaN( geoQuery.Radius ) )
      {
        if( geoQuery.Radius <= 0 )
          throw new ArgumentException( ExceptionMessage.WRONG_RADIUS );

        if( Double.IsNaN( geoQuery.Latitude ) )
          throw new ArgumentNullException( ExceptionMessage.WRONG_LATITUDE_VALUE );

        if( Double.IsNaN( geoQuery.Longitude ) )
          throw new ArgumentNullException( ExceptionMessage.WRONG_LONGITUDE_VALUE );

        CheckCoordinates( geoQuery.Latitude, geoQuery.Longitude );

        if( geoQuery.Units == null )
          throw new ArgumentNullException( ExceptionMessage.NULL_UNIT );
      }
      else if( geoQuery.Categories == null && geoQuery.Metadata == null )
        throw new ArgumentNullException( ExceptionMessage.WRONG_GEO_QUERY );

      if( geoQuery.Categories != null )
        foreach( string categoryName in geoQuery.Categories )
          CheckCategoryName( categoryName );

      if( geoQuery.Offset < 0 )
        throw new ArgumentException( ExceptionMessage.WRONG_OFFSET );

      if( geoQuery.PageSize < 0 )
        throw new ArgumentException( ExceptionMessage.WRONG_PAGE_SIZE );
    }
示例#24
0
 public void SearchPointsInDefaultCategoryFor10MilesTest()
 {
     
     try
     {
         double lon = 10 * 1609.344 * METERS;
         Dictionary<string, string> metadata = new Dictionary<string, string>();
         metadata.Add("A", "aaa");
         metadata.Add("B", "bbb");
         for (int i = 0; i < 10; i++)
         {
             double lat = i * 1609.344 * METERS;
             target.AddPoint(lat,lon,metadata);
         }
         BackendlessGeoQuery geoQuery = new BackendlessGeoQuery(5 * 1609.344 * METERS, 5 * 1609.344 * METERS, 10, Units.MILES);
         var result=target.GetPoints(geoQuery);
         Assert.IsNotNull(result);
     }
     catch (BackendlessException e)
     {
         Assert.Fail(e.Message);
     }
 }
示例#25
0
        public void SearchPointsInCategoriesTest()
        {
            try
            {
                List<string> cateName = new List<string> { "cateName1","cateName2"};

                BackendlessGeoQuery geoQuery = new BackendlessGeoQuery();
                geoQuery.Categories = cateName;
                geoQuery.Radius = 20;
                geoQuery.Units = Units.METERS;
                geoQuery.PageSize = 2;
                geoQuery.Offset = 0;
                var result=target.GetPoints(geoQuery);
                Assert.IsNotNull(result);
            }
            catch (BackendlessException e)
            {
                Assert.Fail(e.Message);
            }
        }
示例#26
0
 public void SearchPointsInDefaultCategoryFor1KilometerTest()
 {
     try
     {
         BackendlessGeoQuery geoQuery = new BackendlessGeoQuery(1.23, 2.36, 1, Units.KILOMETERS);
         var result = target.GetPoints(geoQuery);
         Assert.IsNotNull(result);
     }
     catch (BackendlessException e)
     {
         Assert.Fail(e.Message);
     }
 }
示例#27
0
    public void TestGetPointsByRadiusIn1Kilometer()
    {
      double startingLat = 10;
      double startingLong = 15;
      int maxPoints = 10;
      double offset = 0;
      SetDefinedCategory( GetRandomCategory() );
      Dictionary<string, string> meta = GetRandomSimpleMetadata();

      for( int i = 0; i < maxPoints; i++ )
      {
        offset += METER*100;
        Backendless.Geo.SavePoint( startingLat, startingLong + offset, GetDefinedCategories(), meta );
      }

      BackendlessGeoQuery geoQuery = new BackendlessGeoQuery( startingLat, startingLong + offset/2, 1, Units.KILOMETERS );
      GetCollectionAndCheck( startingLat, startingLong, maxPoints, offset, meta, geoQuery );
    }
示例#28
0
 public BackendlessCollection<GeoPoint> GetPoints( String geofenceName, BackendlessGeoQuery query )
 {
   checkGeoQuery( query );
   Object[] args = new Object[] { Backendless.AppId, Backendless.VersionNum, geofenceName, query };
   BackendlessCollection<GeoPoint> result = Invoker.InvokeSync<BackendlessCollection<GeoPoint>>( GEO_MANAGER_SERVER_ALIAS, "getPoints", args );
   result.Query = query;
   return result;
 }
示例#29
0
 public void SearchPointsWithNegativePagesizeTest()
 {
     try
     {
         BackendlessGeoQuery geoQuery = new BackendlessGeoQuery();
         geoQuery.Latitude = 30;
         geoQuery.Longitude = 60;
         geoQuery.Radius = 20;
         geoQuery.Units = Units.METERS;
         geoQuery.PageSize = -2;
         geoQuery.Offset = 1;
         target.GetPoints(geoQuery);
     }
     catch (BackendlessException e)
     {
         Assert.AreEqual("N/A", e.Code);
     }
 }
示例#30
0
        private static string GetGetPointsQuery(BackendlessGeoQuery geoQuery, out Invoker.Api api)
        {
            string query = null;
              if (geoQuery != null)
              {
            double[] searchRectangle = geoQuery.SearchRectangle;
            if (searchRectangle != null)
            {
              api = Invoker.Api.GEOSERVICE_GETRECT;

              if (searchRectangle.Length == 4)
              {
            AddQuery(ref query, "nwlat=" + searchRectangle[0]);
            AddQuery(ref query, "nwlon=" + searchRectangle[1]);
            AddQuery(ref query, "selat=" + searchRectangle[2]);
            AddQuery(ref query, "selon=" + searchRectangle[3]);
              }
            }
            else
            {
              api = Invoker.Api.GEOSERVICE_GETPOINTS;

              Dictionary<string, string> relativeFindMetadataList = geoQuery.RelativeFindMetadata;
              if (relativeFindMetadataList != null && relativeFindMetadataList.Count > 0)
              {
            api = Invoker.Api.GEOSERVICE_RELATIVEFIND;

            string metadata = JsonMapper.ToJson(relativeFindMetadataList);
            if (string.IsNullOrEmpty(metadata) == false)
              AddQuery(ref query, "relativeFindMetadata=" + UnityEngine.WWW.EscapeURL(metadata));

            AddQuery(ref query, "relativeFindPercentThreshold=" + geoQuery.RelativeFindPercentThreshold);
              }

              if (Double.NaN.Equals(geoQuery.Latitude) == false)
            AddQuery(ref query, "lat=" + geoQuery.Latitude);

              if (Double.NaN.Equals(geoQuery.Longitude) == false)
            AddQuery(ref query, "lon=" + geoQuery.Longitude);

              if (Double.NaN.Equals(geoQuery.Radius) == false)
            AddQuery(ref query, "r=" + geoQuery.Radius);

              Units? unit = geoQuery.Units;
              if (unit != null)
            AddQuery(ref query, "units=" + unit.ToString());
            }

            List<string> categoriesList = geoQuery.Categories;
            if (categoriesList != null && categoriesList.Count > 0)
            {
              string categories = "";
              foreach (string category in categoriesList)
              {
            if (string.IsNullOrEmpty(categories) == false)
              categories += ",";
            categories += category;
              }
              if (string.IsNullOrEmpty(categories) == false)
            AddQuery(ref query, "categories=" + categories);
            }

            Dictionary<string, string> metadataList = geoQuery.Metadata;
            if (metadataList != null && metadataList.Count > 0)
            {
              string metadata = JsonMapper.ToJson(metadataList);
              if (string.IsNullOrEmpty(metadata) == false)
            AddQuery(ref query, "metadata=" + UnityEngine.WWW.EscapeURL(metadata));
            }

            AddQuery(ref query, "includemetadata=" + geoQuery.IncludeMeta.ToString().ToLower());

            AddQuery(ref query, "pagesize=" + geoQuery.PageSize);

            AddQuery(ref query, "offset=" + geoQuery.Offset);
              }
              else
            api = Invoker.Api.UNKNOWN;

              return query;
        }