com.mapbox.geojson.Point Java Examples

The following examples show how to use com.mapbox.geojson.Point. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapboxGeocodingTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void reverseMode_getsAddedToUrlCorrectly() {
  MapboxGeocoding mapboxGeocoding = MapboxGeocoding.builder()
    .accessToken(ACCESS_TOKEN)
    .baseUrl("https://foobar.com")
    .query(Point.fromLngLat(-73.989,40.733))
    .reverseMode(GeocodingCriteria.REVERSE_MODE_SCORE)
    .build();
  assertTrue(mapboxGeocoding.cloneCall().request().url().toString()
    .contains("reverseMode=score"));

  mapboxGeocoding = MapboxGeocoding.builder()
    .accessToken(ACCESS_TOKEN)
    .baseUrl("https://foobar.com")
    .query(Point.fromLngLat(-73.989,40.733))
    .reverseMode(GeocodingCriteria.REVERSE_MODE_DISTANCE)
    .build();
  assertTrue(mapboxGeocoding.cloneCall().request().url().toString()
    .contains("reverseMode=distance"));
}
 
Example #2
Source File: MapboxDirectionsTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void waypointsList_doesGetFormattedInUrlCorrectly() {
  List<Integer> waypointIndices = new ArrayList<>();
  waypointIndices.add(0);
  waypointIndices.add(2);

  MapboxDirections directions = MapboxDirections.builder()
          .destination(Point.fromLngLat(13.4930, 9.958))
          .addWaypoint(Point.fromLngLat(4.56, 7.89))
          .origin(Point.fromLngLat(1.234, 2.345))
          .waypointIndices(waypointIndices)
          .accessToken(ACCESS_TOKEN)
          .build();
  String semicolon = "%3B";
  assertTrue(directions.cloneCall().request().url().toString().contains("waypoints=0" + semicolon + "2"));
}
 
Example #3
Source File: MapboxDirectionsTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void addNullBearings_doesGetFormattedInUrlCorrectly() throws Exception {
  List<Double> bearing1 = new ArrayList<>();
  bearing1.add(45d);
  bearing1.add(90d);

  List<Double> bearing2 = new ArrayList<>();
  bearing2.add(2d);
  bearing2.add(90d);

  List<List<Double>> bearings = new ArrayList<>();
  bearings.add(null);
  bearings.add(null);
  bearings.add(bearing1);
  bearings.add(bearing2);
  bearings.add(null);

  MapboxDirections directions = MapboxDirections.builder()
      .destination(Point.fromLngLat(13.4930, 9.958))
      .origin(Point.fromLngLat(1.234, 2.345))
      .bearings(bearings)
      .accessToken(ACCESS_TOKEN)
      .build();
  assertEquals(";;45,90;2,90;",
      directions.cloneCall().request().url().queryParameter("bearings"));
}
 
Example #4
Source File: TurfMiscTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void testTurfPointOnLinePointsInFrontOfLastPoint() throws TurfException {
  List<Point> line = new ArrayList<>();
  line.add(Point.fromLngLat(-122.45616137981413, 37.72125936929241));
  line.add(Point.fromLngLat(-122.45717525482178, 37.72003306385638));
  line.add(Point.fromLngLat(-122.45717525482178, 37.718242366859215));

  Point last = line.get(2);

  List<Point> pts = new ArrayList<>();
  pts.add(Point.fromLngLat(-122.45696067810057, 37.7181405249708));
  pts.add(Point.fromLngLat(-122.4573630094528, 37.71813203814049));
  pts.add(Point.fromLngLat(-122.45730936527252, 37.71797927502795));
  pts.add(Point.fromLngLat(-122.45718061923981, 37.71704571582896));

  for (Point pt : pts) {
    Feature snappedFeature = TurfMisc.nearestPointOnLine(pt, line);
    Point snapped = (Point) snappedFeature.geometry();
    // pt behind start moves to last vertex
    assertEquals(last, snapped);
  }
}
 
Example #5
Source File: TestRouteBuilder.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
private DirectionsRoute buildRouteWithOptions(DirectionsRoute route) throws IOException {
  List<Point> coordinates = new ArrayList<>();
  RouteOptions routeOptionsWithoutVoiceInstructions = RouteOptions.builder()
    .baseUrl(Constants.BASE_API_URL)
    .user("user")
    .profile("profile")
    .accessToken(ACCESS_TOKEN)
    .requestUuid("uuid")
    .geometries("mocked_geometries")
    .voiceInstructions(true)
    .bannerInstructions(true)
    .coordinates(coordinates).build();

  return route.toBuilder()
    .routeOptions(routeOptionsWithoutVoiceInstructions)
    .build();
}
 
Example #6
Source File: TurfMiscTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void testTurfPointOnLinePointsOnSidesOfLinesCustomUnit() throws TurfException {
  List<Point> line = new ArrayList<>();
  line.add(Point.fromLngLat(-122.45616137981413, 37.72125936929241));
  line.add(Point.fromLngLat(-122.45717525482178, 37.718242366859215));
  Point first = line.get(0);
  Point last = line.get(1);

  List<Point> pts = new ArrayList<>();
  pts.add(Point.fromLngLat(-122.45702505111694, 37.71881098149625));
  pts.add(Point.fromLngLat(-122.45733618736267, 37.719235317933844));
  pts.add(Point.fromLngLat(-122.45686411857605, 37.72027068864082));
  pts.add(Point.fromLngLat(-122.45652079582213, 37.72063561093274));

  for (Point pt : pts) {
    Feature snappedFeature = TurfMisc.nearestPointOnLine(pt, line, TurfConstants.UNIT_MILES);
    Point snapped = (Point) snappedFeature.geometry();
    // pt did not snap to first vertex
    assertNotEquals(snapped, first);
    // pt did not snap to last vertex
    assertNotEquals(snapped, last);
  }
}
 
Example #7
Source File: TurfMiscTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void testShortLine() throws IOException, TurfException {

  // Distance between points is about 186 miles
  LineString lineStringLine1 = LineString.fromLngLats(Arrays.asList(
    Point.fromLngLat(113.99414062499999, 22.350075806124867),
    Point.fromLngLat(116.76269531249999, 23.241346102386135)));

  double start = 50;
  double stop =  100;

  Point start_point = TurfMeasurement.along(lineStringLine1, start, TurfConstants.UNIT_MILES);
  Point end_point = TurfMeasurement.along(lineStringLine1, stop, TurfConstants.UNIT_MILES);
  LineString sliced = TurfMisc.lineSliceAlong(lineStringLine1, start, stop, TurfConstants.UNIT_MILES);

  assertEquals(sliced.coordinates().get(0).coordinates(),
    start_point.coordinates());
  assertEquals(sliced.coordinates().get(sliced.coordinates().size() - 1).coordinates(),
    end_point.coordinates());
}
 
Example #8
Source File: MapboxDirectionsTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void waypointList_doesGetFormattedInUrlCorrectly() {
  List<Integer> waypointIndices = new ArrayList<>();
  waypointIndices.add(0);
  waypointIndices.add(2);

  MapboxDirections directions = MapboxDirections.builder()
          .destination(Point.fromLngLat(13.4930, 9.958))
          .addWaypoint(Point.fromLngLat(4.56, 7.89))
          .origin(Point.fromLngLat(1.234, 2.345))
          .addWaypoint(Point.fromLngLat(4.56, 7.89))
          .waypointIndices(waypointIndices)
          .addWaypointIndex(3)
          .accessToken(ACCESS_TOKEN)
          .build();

  assertEquals("0;2;3", directions.cloneCall().request().url().queryParameter("waypoints"));
}
 
Example #9
Source File: MapMatchingResponseTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  server = new MockWebServer();
  server.setDispatcher(new okhttp3.mockwebserver.Dispatcher() {
    @Override
    public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
      try {
        String response = loadJsonFixture(MAP_MATCHING_FIXTURE);
        return new MockResponse().setBody(response);
      } catch (IOException ioException) {
        throw new RuntimeException(ioException);
      }
    }
  });
  server.start();
  mockUrl = server.url("");

  coordinates = new ArrayList<>();
  coordinates.add(Point.fromLngLat(13.418946862220764, 52.50055852688439));
  coordinates.add(Point.fromLngLat(13.419011235237122, 52.50113000479732));
  coordinates.add(Point.fromLngLat(13.419756889343262, 52.50171780290061));
  coordinates.add(Point.fromLngLat(13.419885635375975, 52.50237416816131));
  coordinates.add(Point.fromLngLat(13.420631289482117, 52.50294888790448));
}
 
Example #10
Source File: TurfMeasurementTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void bboxPolygonFromLineString() throws IOException, TurfException {
  // Create a LineString
  LineString lineString = LineString.fromJson(loadJsonFixture(TURF_BBOX_POLYGON_LINESTRING));

  // Use the LineString object to calculate its BoundingBox area
  double[] bbox = TurfMeasurement.bbox(lineString);

  // Use the BoundingBox coordinates to create an actual BoundingBox object
  BoundingBox boundingBox = BoundingBox.fromPoints(
    Point.fromLngLat(bbox[0], bbox[1]), Point.fromLngLat(bbox[2], bbox[3]));

  // Use the BoundingBox object in the TurfMeasurement.bboxPolygon() method.
  Feature featureRepresentingBoundingBox = TurfMeasurement.bboxPolygon(boundingBox);

  Polygon polygonRepresentingBoundingBox = (Polygon) featureRepresentingBoundingBox.geometry();

  assertNotNull(polygonRepresentingBoundingBox);
  assertEquals(0, polygonRepresentingBoundingBox.inner().size());
  assertEquals(5, polygonRepresentingBoundingBox.coordinates().get(0).size());
  assertEquals(Point.fromLngLat(102.0, -10.0), polygonRepresentingBoundingBox.coordinates().get(0).get(0));
  assertEquals(Point.fromLngLat(130, -10.0), polygonRepresentingBoundingBox.coordinates().get(0).get(1));
  assertEquals(Point.fromLngLat(130.0, 4.0), polygonRepresentingBoundingBox.coordinates().get(0).get(2));
  assertEquals(Point.fromLngLat(102.0, 4.0), polygonRepresentingBoundingBox.coordinates().get(0).get(3));
  assertEquals(Point.fromLngLat(102.0, -10.0), polygonRepresentingBoundingBox.coordinates().get(0).get(4));
}
 
Example #11
Source File: MapboxMapMatchingTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void testGetIsUsed() {
  MapboxMapMatching.Builder builder = MapboxMapMatching.builder()
    .profile(PROFILE_CYCLING)
    .steps(true)
    .coordinate(Point.fromLngLat(-122.42,37.78))
    .coordinate(Point.fromLngLat(-77.03,38.91))
    .voiceInstructions(true)
    .voiceUnits(DirectionsCriteria.IMPERIAL)
    .accessToken(ACCESS_TOKEN)
    .baseUrl(mockUrl.toString())
    .get();

  retrofit2.Call<MapMatchingResponse> call = builder.build().initializeCall();

  assertEquals("GET", call.request().method());
}
 
Example #12
Source File: MapboxDirectionsTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void postIsUsed() {
  MapboxDirections.Builder builder = MapboxDirections.builder()
    .profile(PROFILE_CYCLING)
    .steps(true)
    .origin(Point.fromLngLat(-122.42,37.78))
    .destination(Point.fromLngLat(-77.03,38.91))
    .voiceInstructions(true)
    .voiceUnits(DirectionsCriteria.IMPERIAL)
    .accessToken(ACCESS_TOKEN)
    .baseUrl(mockUrl.toString())
    .post();

  retrofit2.Call<DirectionsResponse> call = builder.build().initializeCall();

  assertEquals("POST", call.request().method());
}
 
Example #13
Source File: ValidationUtilsTest.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
private DirectionsRoute buildRouteWithNullInstructions() throws IOException {
  DirectionsRoute route = buildTestDirectionsRoute();
  List<Point> coordinates = new ArrayList<>();
  RouteOptions routeOptionsWithoutVoiceInstructions = RouteOptions.builder()
    .baseUrl(Constants.BASE_API_URL)
    .user("user")
    .profile("profile")
    .accessToken(ACCESS_TOKEN)
    .requestUuid("uuid")
    .geometries("mocked_geometries")
    .coordinates(coordinates).build();

  return route.toBuilder()
    .routeOptions(routeOptionsWithoutVoiceInstructions)
    .build();
}
 
Example #14
Source File: MapboxDirectionsTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void withWaypointNames() throws Exception {
  List<String> names = new ArrayList<>();
  names.add("Home");
  names.add("Work");

  MapboxDirections mapboxDirections = MapboxDirections.builder()
    .profile(PROFILE_CYCLING)
    .origin(Point.fromLngLat(-122.42,37.78))
    .destination(Point.fromLngLat(-77.03,38.91))
    .steps(true)
    .voiceInstructions(true)
    .voiceUnits(DirectionsCriteria.IMPERIAL)
    .waypointNames(names)
    .accessToken(ACCESS_TOKEN)
    .baseUrl(mockUrl.toString())
    .build();

  mapboxDirections.setCallFactory(null);
  Response<DirectionsResponse> response = mapboxDirections.executeCall();
  assertEquals(200, response.code());
  assertEquals("Ok", response.body().code());
}
 
Example #15
Source File: MapboxDirectionsTest.java    From mapbox-java with MIT License 6 votes vote down vote up
@Test
public void callFactoryNonNull() throws IOException {
  MapboxDirections client = MapboxDirections.builder()
    .accessToken(ACCESS_TOKEN)
    .origin(Point.fromLngLat(1.0, 2.0))
    .destination(Point.fromLngLat(5.0, 6.0))
    .baseUrl(mockUrl.toString())
    .build();

  // Setting a null call factory doesn't make the request fail
  // (the default OkHttp client is used)
  client.setCallFactory(null);
  Response<DirectionsResponse> response = client.executeCall();
  assertEquals(200, response.code());
  assertEquals("Ok", response.body().code());
}
 
Example #16
Source File: AirMapMapView.java    From AirMapSDK-Android with Apache License 2.0 5 votes vote down vote up
private void zoomToFeatureIfNecessary(Feature featureClicked) {
    LatLngBounds cameraBounds = getMap().getProjection().getVisibleRegion().latLngBounds;
    LatLngBounds.Builder advisoryLatLngsBuilder = new LatLngBounds.Builder();
    boolean zoom = false;

    Geometry geometry = featureClicked.geometry();
    List<Point> points = new ArrayList<>();
    if (geometry instanceof Polygon) {
        points.addAll(((Polygon) geometry).outer().coordinates());
    } else if (geometry instanceof MultiPolygon) {
        List<Polygon> polygons = ((MultiPolygon) geometry).polygons();
        for (Polygon polygon : polygons) {
            points.addAll(polygon.outer().coordinates());
        }
    }

    for (Point position : points) {
        LatLng latLng = new LatLng(position.latitude(), position.longitude());
        advisoryLatLngsBuilder.include(latLng);
        if (!cameraBounds.contains(latLng)) {
            Timber.d("Camera position doesn't contain point");
            zoom = true;
        }
    }

    if (zoom) {
        int padding = Utils.dpToPixels(getContext(), 72).intValue();
        getMap().moveCamera(CameraUpdateFactory.newLatLngBounds(advisoryLatLngsBuilder.build(), padding));
    }
}
 
Example #17
Source File: NavigationLauncherActivity.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
@Override
public void onMapLongClick(@NonNull LatLng point) {
  destination = Point.fromLngLat(point.getLongitude(), point.getLatitude());
  launchRouteBtn.setEnabled(false);
  loading.setVisibility(View.VISIBLE);
  setCurrentMarkerPosition(point);
  if (currentLocation != null) {
    fetchRoute();
  }
}
 
Example #18
Source File: NavigationFragment.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private void fetchRoute(Point origin, Point destination) {
  NavigationRoute.builder(getContext())
    .accessToken(Mapbox.getAccessToken())
    .origin(origin)
    .destination(destination)
    .build()
    .getRoute(new SimplifiedCallback() {
      @Override
      public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) {
        directionsRoute = response.body().routes().get(0);
        startNavigation();
      }
    });
}
 
Example #19
Source File: MapboxMatrixTest.java    From mapbox-java with MIT License 5 votes vote down vote up
@Before
public void setUp() throws IOException {
  server = new MockWebServer();

  server.setDispatcher(new Dispatcher() {

    @Override
    public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
      try {
        String resource;
        if (request.getPath().contains("walking")) {
          resource = DIRECTIONS_MATRIX_WALKING_1X3_FIXTURE;

        } else if (request.getPath().contains("cycling")) {
          resource = DIRECTIONS_MATRIX_CYCLING_2X3_FIXTURE;

        } else { // driving
          resource = DIRECTIONS_MATRIX_DRIVING_3X3_FIXTURE;
        }
        String response = loadJsonFixture(resource);
        return new MockResponse().setBody(response);
      } catch (IOException ioException) {
        throw new RuntimeException(ioException);
      }
    }
  });
  server.start();
  mockUrl = server.url("");

  positions = new ArrayList<>();
  positions.add(Point.fromLngLat(-122.42, 37.78));
  positions.add(Point.fromLngLat(-122.45, 37.91));
  positions.add(Point.fromLngLat(-122.48, 37.73));
}
 
Example #20
Source File: MapboxDirectionsTest.java    From mapbox-java with MIT License 5 votes vote down vote up
@Test
public void build_noAccessTokenExceptionThrown() throws Exception {
  thrown.expect(IllegalStateException.class);
  thrown.expectMessage("Missing required properties: accessToken");
  MapboxDirections.builder()
    .origin(Point.fromLngLat(1.0, 1.0))
    .destination(Point.fromLngLat(2.0, 2.0))
    .build();
}
 
Example #21
Source File: MapboxDirectionsTest.java    From mapbox-java with MIT License 5 votes vote down vote up
@Test(expected = ServicesException.class)
public void build_exceptionThrownWhenLessThanTwoWaypointsProvided() {
  MapboxDirections.builder()
          .origin(Point.fromLngLat(2.0, 2.0))
          .destination(Point.fromLngLat(4.0, 4.0))
          .addWaypointIndex(0)
          .baseUrl("https://foobar.com")
          .accessToken(ACCESS_TOKEN)
          .build();
}
 
Example #22
Source File: RerouteActivity.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private void getRoute(Point origin, Point destination, Float bearing) {
  Double heading = bearing == null ? null : bearing.doubleValue();
  NavigationRoute.builder(this)
    .origin(origin, heading, 90d)
    .destination(destination)
    .accessToken(Mapbox.getAccessToken())
    .build().getRoute(this);
}
 
Example #23
Source File: RerouteActivity.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
@Override
public void onMapClick(@NonNull LatLng point) {
  if (!running || mapboxMap == null) {
    return;
  }

  mapboxMap.addMarker(new MarkerOptions().position(point));
  mapboxMap.setOnMapClickListener(null);

  Point newDestination = Point.fromLngLat(point.getLongitude(), point.getLatitude());
  mockLocationEngine.moveTo(newDestination);
  destination = Point.fromLngLat(point.getLongitude(), point.getLatitude());
  tracking = false;
}
 
Example #24
Source File: StaticMarkerAnnotationTest.java    From mapbox-java with MIT License 5 votes vote down vote up
@Test
public void iconUrl_formattedInUrlCorrectly() throws Exception {
  StaticMarkerAnnotation marker = StaticMarkerAnnotation.builder()
    .iconUrl("https://foobar.com")
    .lnglat(Point.fromLngLat(0.0, 0.0))
    .build();
  assertTrue(marker.url().contains("url-https://foobar.com(0.000000,0.000000)"));
}
 
Example #25
Source File: OffRouteDetector.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private boolean isMovingAwayFromManeuver(Location location, RouteProgress routeProgress,
                                         RingBuffer<Integer> distancesAwayFromManeuver, Point currentPoint) {
  List<Point> stepPoints = routeProgress.currentStepPoints();
  if (movingAwayFromManeuver(routeProgress, distancesAwayFromManeuver, stepPoints, currentPoint)) {
    updateLastReroutePoint(location);
    return true;
  }
  return false;
}
 
Example #26
Source File: MeasurementUtilsTest.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
@Test
public void userTrueDistanceFromStep_onlyOnePointInLineStringStillMeasuresDistanceCorrectly() {
  Point futurePoint = Point.fromLngLat(-95.3676974, 29.7589382);

  List<Point> geometryPoints = new ArrayList<>();
  geometryPoints.add(Point.fromLngLat(-95.8427, 29.7757));
  double[] rawLocation = {0, 0};
  LegStep step = getLegStep(rawLocation, geometryPoints);

  double distance = MeasurementUtils.userTrueDistanceFromStep(futurePoint, step);
  assertEquals(45900.73617999494, distance, DELTA);
}
 
Example #27
Source File: NavigationViewEventDispatcherTest.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
@Test
public void onRouteListenerNotSet_allowRerouteListenerIsNotCalled() throws Exception {
  NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher();
  RouteListener routeListener = mock(RouteListener.class);
  Point point = mock(Point.class);

  eventDispatcher.allowRerouteFrom(point);

  verify(routeListener, times(0)).allowRerouteFrom(point);
}
 
Example #28
Source File: NavigationViewEventDispatcherTest.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
@Test
public void onRouteListenerNotSet_offRouteListenerIsNotCalled() throws Exception {
  NavigationViewEventDispatcher eventDispatcher = new NavigationViewEventDispatcher();
  RouteListener routeListener = mock(RouteListener.class);
  Point point = mock(Point.class);

  eventDispatcher.onOffRoute(point);

  verify(routeListener, times(0)).onOffRoute(point);
}
 
Example #29
Source File: MapboxOptimization.java    From mapbox-java with MIT License 5 votes vote down vote up
private static String formatCoordinates(List<Point> coordinates) {
  List<String> coordinatesFormatted = new ArrayList<>();
  for (Point point : coordinates) {
    coordinatesFormatted.add(String.format(Locale.US, "%s,%s",
      FormatUtils.formatCoordinate(point.longitude()),
      FormatUtils.formatCoordinate(point.latitude())));
  }

  return TextUtils.join(";", coordinatesFormatted.toArray());
}
 
Example #30
Source File: PlaceAutocompleteViewModel.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void buildGeocodingRequest(String accessToken) {
  geocoderBuilder = MapboxGeocoding.builder().autocomplete(true);
  geocoderBuilder.accessToken(accessToken);
  geocoderBuilder.limit(placeOptions.limit());
  if (placeOptions.baseUrl() != null) {
    geocoderBuilder.baseUrl(placeOptions.baseUrl());
  }

  // Proximity
  Point proximityPoint = placeOptions.proximity();
  if (proximityPoint != null) {
    geocoderBuilder.proximity(proximityPoint);
  }

  // Language
  String languageJson = placeOptions.language();
  if (languageJson != null) {
    geocoderBuilder.languages(languageJson);
  }

  // Type
  String typeJson = placeOptions.geocodingTypes();
  if (typeJson != null) {
    geocoderBuilder.geocodingTypes(typeJson);
  }

  // Countries
  String countriesJson = placeOptions.country();
  if (countriesJson != null) {
    geocoderBuilder.country(countriesJson);
  }

  // Bounding box
  String bbox = placeOptions.bbox();
  if (bbox != null) {
    geocoderBuilder.bbox(bbox);
  }
}