-
Notifications
You must be signed in to change notification settings - Fork 1
KML Review #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
KML Review #6
Changes from 250 commits
1c906e2
e8d3730
fa49934
82f120d
024a477
b498f08
a5f1d71
6b7c6d9
c291f46
86be7c5
c5f9143
2aa59de
ca3f980
681e643
c5b7a1f
71bcf9b
888e313
2f4a4cb
1c4f0c9
1bd6191
529b223
1b8fc50
c239186
aa17643
45bab0f
8e0546a
ad98f6f
eb09a5b
dd24732
83efafc
4f4e286
8c5201e
e62c468
264198e
f41699b
1172068
3de0e63
20bd9d7
9d33d56
021b267
cc8853e
b27b7fe
f0df9d1
465afde
d0609c2
e1e5ac4
2454853
294af51
c554c8b
a3bfd6a
05502be
61b7c0e
ed2700f
7465a8d
06eeae7
e58442a
afe1843
ec5b764
47a2aaf
77563f4
eb913a8
a44f601
e6328bc
8878a74
9b5896e
5bcc1d3
8abab35
b420ec9
6d65e06
ad48265
63751cc
0bb7de2
06e1198
0169eec
d539b74
16b9021
0107258
6da5a38
254ca40
cec65f8
f3fafa3
8c35de6
c91a39c
97fef89
6d65b96
933a031
1c2490c
4e9b038
d9dd85e
0beb8fb
44f0b6a
058f49f
5b7b049
d7e7933
a58e528
90f456d
479fae4
7a6438f
91d6fce
a9c3d1b
624efa7
7be2a93
4273c58
045a09e
1f01fd7
8d76802
8557c02
a4a6df2
e2d3d87
02222a7
9a564d1
1b91a53
3bfb5da
cb2dd27
278c2d3
486ccee
fe716d6
2facf23
29850b8
2135e3f
4445420
529de63
b50c743
c9f293a
8d6142f
d1cc4df
c5da7be
dfb8b3c
6bae8b8
62bfa59
747f165
d123cf7
e1ae3fa
8ee262d
492c2ae
1e085cf
23933d2
67f84a0
4fbce85
536b868
6760590
e664ca2
fe3c5d5
08510fd
1d54a89
1158331
09d300f
e56c9ce
0e83a3a
fb20a66
0052fce
fffb80d
ea8ccbc
2d797bb
5cb9103
96729b0
9e4e915
5c4c618
59e69be
158ad5b
64171d3
6a0e7b8
d92649a
ba42830
ebcbc74
f157c3f
e9ee72a
2cbd6a5
5bc9c40
2dcbc90
b2604cb
8ae1483
5278496
3781da1
02287e0
b6e8167
4b3a82b
0039f97
d93103f
dd7f050
8f81f53
581273e
5094e8a
4ad6f51
a3ce6ca
718f849
00c844e
9a2aeb2
bce41d9
0c154b7
ab819b8
faa3c25
df6fa24
624ef01
f9396cd
ac773ef
4a87434
3b564f1
6b8fd78
967462a
7fea8cc
40bf540
50da4fd
1bdf284
a1023be
eedf8fe
1c47eaf
d050f82
7d63284
2404538
687ebf6
070856d
6458f63
185e1a9
1820b34
fe5c31a
4123900
ce3a1d3
0f6e274
bd64770
58a9cb6
369ba87
37d635b
a5a48e6
82eff66
a7413fb
0006b9c
4ee566e
897b1e6
2c8505e
38d82de
f28de17
0caa16a
9f0dbd4
8419eeb
d84b68c
33224ef
0ccb0d5
3991d3c
6a13bf4
c262229
c76f9f0
64d73ea
c4a3efc
ff65230
4d10464
e6e0c60
a90f1bc
4fd0902
a322e93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<fragment | ||
android:id="@+id/map" | ||
android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
android:layout_weight="1" | ||
android:name="com.google.android.gms.maps.SupportMapFragment" | ||
tools:layout="@layout/geojson_demo"/> | ||
|
||
|
||
</LinearLayout> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:orientation="vertical" | ||
android:layout_above="@id/textView" | ||
android:layout_below="@+id/map" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<fragment | ||
android:id="@+id/map" | ||
android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
android:layout_weight="1" | ||
android:name="com.google.android.gms.maps.SupportMapFragment" | ||
tools:layout="@layout/kml_demo"/> | ||
|
||
|
||
</LinearLayout> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<kml xmlns="http://www.opengis.net/kml/2.2"> | ||
<Document> | ||
<name>Polygon.kml</name> | ||
<open>0</open> | ||
<Placemark> | ||
<name>hollow box</name> | ||
<Polygon> | ||
<extrude>1</extrude> | ||
<altitudeMode>relativeToGround</altitudeMode> | ||
<outerBoundaryIs> | ||
<LinearRing> | ||
<coordinates> | ||
-122.366278,37.818844,30 | ||
-122.365248,37.819267,30 | ||
-122.365640,37.819861,30 | ||
-122.366669,37.819429,30 | ||
-122.366278,37.818844,30 | ||
</coordinates> | ||
</LinearRing> | ||
</outerBoundaryIs> | ||
<innerBoundaryIs> | ||
<LinearRing> | ||
<coordinates> | ||
-122.366212,37.818977,30 | ||
-122.365424,37.819294,30 | ||
-122.365704,37.819731,30 | ||
-122.366488,37.819402,30 | ||
-122.366212,37.818977,30 | ||
</coordinates> | ||
</LinearRing> | ||
</innerBoundaryIs> | ||
</Polygon> | ||
</Placemark> | ||
</Document> | ||
</kml> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<kml> | ||
<Style id="markerStyle"> | ||
<IconStyle> | ||
<color>a1ff00ff</color> | ||
</IconStyle> | ||
</Style> | ||
|
||
<Placemark> | ||
<styleUrl>#markerStyle</styleUrl> | ||
<Point> | ||
<coordinates>-90.86948943473118,48.25450093195546</coordinates> | ||
</Point> | ||
</Placemark> | ||
</kml> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package com.google.maps.android.utils.demo; | ||
|
||
import com.google.android.gms.maps.model.BitmapDescriptorFactory; | ||
import com.google.android.gms.maps.model.LatLng; | ||
import com.google.maps.android.geojson.GeoJsonFeature; | ||
import com.google.maps.android.geojson.GeoJsonLayer; | ||
import com.google.maps.android.geojson.GeoJsonPoint; | ||
import com.google.maps.android.geojson.GeoJsonPointStyle; | ||
|
||
import org.json.JSONObject; | ||
|
||
/** | ||
* Created by juliawong on 12/1/14. | ||
*/ | ||
public class GeoJsonDemoActivity extends BaseDemoActivity { | ||
|
||
protected int getLayoutId() { | ||
return R.layout.geojson_demo; | ||
} | ||
|
||
@Override | ||
protected void startDemo() { | ||
try { | ||
JSONObject geoJson = new JSONObject( | ||
"{ \"type\": \"FeatureCollection\",\n" | ||
+ "\"bbox\": [-150.0, -80.0, 150.0, 80.0]," | ||
+ " \"features\": [\n" | ||
+ " { \"type\": \"Feature\",\n" | ||
+ " \"id\": \"point\", \n" | ||
+ " \"geometry\": {\"type\": \"Point\", \"coordinates\": [102.0, 0.5]},\n" | ||
+ " \"properties\": {\"prop0\": \"value0\"}\n" | ||
+ " },\n" | ||
+ " { \"type\": \"Feature\",\n" | ||
+ " \"geometry\": {\n" | ||
+ " \"type\": \"LineString\",\n" | ||
+ " \"coordinates\": [\n" | ||
+ " [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]\n" | ||
+ " ]\n" | ||
+ " },\n" | ||
+ " \"properties\": {\n" | ||
+ " \"prop0\": \"value0\",\n" | ||
+ " \"prop1\": 0.0\n" | ||
+ " }\n" | ||
+ " },\n" | ||
+ " { \"type\": \"Feature\",\n" | ||
+ " \"geometry\": {\n" | ||
+ " \"type\": \"Polygon\",\n" | ||
+ " \"coordinates\": [\n" | ||
+ " [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],\n" | ||
+ " [100.0, 1.0], [100.0, 0.0] ]\n" | ||
+ " ]\n" | ||
+ " },\n" | ||
+ " \"properties\": {\n" | ||
+ " \"prop0\": \"value0\",\n" | ||
+ " \"prop1\": {\"this\": \"that\"}\n" | ||
+ " }\n" | ||
+ " }\n" | ||
+ " ]\n" | ||
+ " }" | ||
); | ||
GeoJsonLayer layer = new GeoJsonLayer(getMap(), geoJson); | ||
layer.addLayer(); | ||
GeoJsonPointStyle pointStyle = new GeoJsonPointStyle(); | ||
pointStyle.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA)); | ||
layer.setDefaultPointStyle(pointStyle); | ||
layer.addFeature( | ||
new GeoJsonFeature(new GeoJsonPoint(new LatLng(0, 0)), null, null, null)); | ||
layer.addFeature( | ||
new GeoJsonFeature(new GeoJsonPoint(new LatLng(10, 10)), null, null, null)); | ||
layer.clearLayer(); | ||
pointStyle = new GeoJsonPointStyle(); | ||
pointStyle.setTitle("BANANANA!"); | ||
layer.setDefaultPointStyle(pointStyle); | ||
layer.addLayer(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ public class HeatmapsPlacesDemoActivity extends BaseDemoActivity { | |
/** | ||
* Places API server key. | ||
*/ | ||
private static final String API_KEY = "YOUR_KEY_HERE"; // TODO place your own here! | ||
private static final String API_KEY = "AIzaSyDe3Ivf9_tRPzoxzSKIWxJxH6uCLB6H9ww"; // TODO place your own here! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert this. It really should live in a resource file but that's not in scope for your changes. |
||
|
||
/** | ||
* The colors to be used for the different heatmap layers. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package com.google.maps.android.utils.demo; | ||
|
||
import com.google.android.gms.maps.CameraUpdateFactory; | ||
import com.google.android.gms.maps.GoogleMap; | ||
import com.google.maps.android.kml.KmlContainer; | ||
import com.google.maps.android.kml.KmlLayer; | ||
import com.google.maps.android.kml.KmlPlacemark; | ||
import com.google.maps.android.kml.KmlPolygon; | ||
|
||
import org.xmlpull.v1.XmlPullParserException; | ||
|
||
import android.graphics.Typeface; | ||
import android.os.AsyncTask; | ||
import android.text.Html; | ||
import android.text.method.ScrollingMovementMethod; | ||
import android.util.Log; | ||
import android.widget.TextView; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
|
||
public class KmlDemoActivity extends BaseDemoActivity { | ||
GoogleMap mMap; | ||
|
||
protected int getLayoutId() { | ||
return R.layout.kml_demo; | ||
} | ||
|
||
public void startDemo () { | ||
try { | ||
Log.i("Demo", "Start"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these logs useful for anything? They look like leftover debug statements. If they're useful, make the messages more descriptive, if they're not, remove them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, they're leftover debug statements - Removed them |
||
KmlLayer kmlLayer = new KmlLayer(getMap(), R.raw.point, getApplicationContext()); | ||
kmlLayer.addLayer(); | ||
KmlContainer container = kmlLayer.getContainers().iterator().next(); | ||
KmlPlacemark placemark = container.getPlacemarks().iterator().next(); | ||
KmlPolygon polygon = (KmlPolygon) placemark.getGeometry(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spacing is off here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
polygon.getOuterBoundaryCoordinates().get(0); | ||
getMap().moveCamera(CameraUpdateFactory.newLatLngZoom( | ||
polygon.getOuterBoundaryCoordinates().get(0), 18)); | ||
Log.i("Demo", "End"); | ||
} catch (Exception e) { | ||
Log.e("Exception caught", e.toString()); | ||
} | ||
} | ||
|
||
private class DownloadKmlFile extends AsyncTask<String, Void, byte[]> { | ||
private final String mUrl; | ||
|
||
public DownloadKmlFile(String url) { | ||
mUrl = url; | ||
} | ||
|
||
@Override | ||
protected byte[] doInBackground(String... params) { | ||
|
||
try { | ||
InputStream is = new URL(mUrl).openStream(); | ||
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | ||
int nRead; | ||
byte[] data = new byte[16384]; | ||
while ((nRead = is.read(data, 0, data.length)) != -1) { | ||
buffer.write(data, 0, nRead); | ||
} | ||
|
||
buffer.flush(); | ||
|
||
return buffer.toByteArray(); | ||
|
||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
protected void onPostExecute(byte[] byteArr) { | ||
try { | ||
KmlLayer layer = new KmlLayer(mMap, new ByteArrayInputStream(byteArr), | ||
getApplicationContext()); | ||
layer.addLayer(); | ||
} catch (XmlPullParserException e) { | ||
e.printStackTrace(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Oct 08 10:43:50 MDT 2014 | ||
#Wed Dec 17 14:51:18 EST 2014 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't do this :)