showing polygon, line, and markers together #1716
This commit is contained in:
@@ -296,6 +296,12 @@ public class MainActivity extends ActionBarActivity {
|
||||
.position(backLot)
|
||||
.title("Back Lot")
|
||||
.snippet("The back lot behind my house"));
|
||||
|
||||
LatLng cheeseRoom = new LatLng(38.531577,-122.010646);
|
||||
map.addMarker(new MarkerOptions()
|
||||
.position(cheeseRoom)
|
||||
.title("Cheese Room")
|
||||
.snippet("The only air conditioned room on the property!"));
|
||||
}
|
||||
|
||||
private void addPolyline() {
|
||||
@@ -321,7 +327,7 @@ public class MainActivity extends ActionBarActivity {
|
||||
LatLng[] latLngs = Util.parseGeoJSONCoordinates(geojsonStr);
|
||||
MapView map = mMapFragment.getMap();
|
||||
Polygon polygon = map.addPolygon(new PolygonOptions()
|
||||
.add(new LatLng(0, 0), new LatLng(0, 5), new LatLng(3, 5), new LatLng(0, 0))
|
||||
.add(latLngs)
|
||||
.strokeColor(Color.MAGENTA)
|
||||
.fillColor(Color.BLUE));
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mapbox.mapboxgl.geometry.LatLng;
|
||||
import com.mapbox.mapboxgl.views.MapView;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -77,6 +78,8 @@ public class MapFragment extends Fragment {
|
||||
|
||||
// Need to pass on to view
|
||||
mMap.onStart();
|
||||
mMap.setCenterCoordinate(new LatLng(38.247887,-121.843872));
|
||||
mMap.setZoomLevel(7);
|
||||
}
|
||||
|
||||
// Called when the fragment is invisible
|
||||
|
||||
Reference in New Issue
Block a user