Skip to content

GeoJSON Review #5

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

Open
wants to merge 384 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
384 commits
Select commit Hold shift + click to select a range
4f4e286
Renamed files to be prefixed with Kml. Added more support for recursi…
juliawong Jan 8, 2015
8c5201e
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 8, 2015
e62c468
Added more kml files for demos
juliawong Jan 8, 2015
264198e
:cookie: Points, LineStrings and Polygons are successfully being draw…
juliawong Jan 8, 2015
f41699b
Geometry collections can be added and removed from the map - Nested g…
lchans Jan 8, 2015
1172068
:cow2: MultiGeometry adding to the map
juliawong Jan 8, 2015
3de0e63
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 8, 2015
20bd9d7
Added test skeleton files
juliawong Jan 9, 2015
9d33d56
Added tests for features
lchans Jan 9, 2015
021b267
Added support for the normal style tag in StyleMap
juliawong Jan 9, 2015
cc8853e
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 9, 2015
b27b7fe
Added public methods remove, set z index and get placemarks
juliawong Jan 9, 2015
f0df9d1
Fixed minor syntax error and removed old code
juliawong Jan 9, 2015
465afde
Added additional tests for GeoJsonParser
lchans Jan 12, 2015
d0609c2
Modified KmlLayer to download icons once and add to many markers
juliawong Jan 12, 2015
e1e5ac4
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 12, 2015
2454853
Minor refactor of KmlLayer to utilise LruCache
juliawong Jan 12, 2015
294af51
Refactored code to not store Marker objects twice, uses LruCache more…
juliawong Jan 12, 2015
c554c8b
Reformatted code, added TODO
juliawong Jan 12, 2015
a3bfd6a
Added exceptions for null coordinates. Renamed KmlGeometry method
juliawong Jan 12, 2015
05502be
Added tests for getType
juliawong Jan 12, 2015
61b7c0e
Updated demo files and grade files
juliawong Jan 12, 2015
ed2700f
Added comments
lchans Jan 12, 2015
7465a8d
Changed GeoJsonGeometry to an interface
juliawong Jan 12, 2015
06eeae7
Minor syntax correction
juliawong Jan 12, 2015
e58442a
Seperated KMLParser into KMLStyleParser and KMLPlacemarkParser
lchans Jan 12, 2015
afe1843
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 12, 2015
ec5b764
Refactored code, ran reformatter and added some JavaDoc
juliawong Jan 12, 2015
47a2aaf
Renamed tests
juliawong Jan 12, 2015
77563f4
Added support for bbox in FeatureCollection
juliawong Jan 13, 2015
eb913a8
Implemented addFeature, removeFeature methods
juliawong Jan 13, 2015
a44f601
Refactored rendering of GeometryCollection
juliawong Jan 13, 2015
e6328bc
Implemented Folders, however need to also create a Document class so …
lchans Jan 14, 2015
8878a74
:balloon: Added and redid Javadoc. Minor refactor of code.
juliawong Jan 14, 2015
9b5896e
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 14, 2015
5bcc1d3
Modified methods to add and remove data to allow developers to call a…
juliawong Jan 14, 2015
8abab35
Prevented feature redrawing if different type style was set
juliawong Jan 14, 2015
b420ec9
Features are redrawn when styles are updated
juliawong Jan 15, 2015
6d65e06
Can handle nested folders and overriding styles in KML
lchans Jan 15, 2015
ad48265
Added tests for style classes
juliawong Jan 15, 2015
63751cc
Minor clean ups
juliawong Jan 15, 2015
0bb7de2
Can fetch a url for a marker in folders
lchans Jan 16, 2015
06e1198
Caught exceptions and logging when GeoJSON could not be parsed.
juliawong Jan 16, 2015
0169eec
Reformatting tests and minor clean ups
juliawong Jan 16, 2015
d539b74
Implemented API methods for Folders
lchans Jan 16, 2015
16b9021
Added more tests for null coordinates
juliawong Jan 16, 2015
0107258
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 16, 2015
6da5a38
Implement public API methods for KMLLayer
lchans Jan 16, 2015
254ca40
KmlGeometry is now typed
juliawong Jan 18, 2015
cec65f8
Added comments to code
lchans Jan 18, 2015
f3fafa3
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Jan 18, 2015
8c35de6
BoundingBox stored as a LatLngBounds object
juliawong Jan 19, 2015
c91a39c
Renamed package to geojson
juliawong Jan 19, 2015
97fef89
Made Documents a KmlContainer (Can now have nested Documents, however…
lchans Jan 19, 2015
6d65b96
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Jan 19, 2015
933a031
Refactor to store map objects in GeoJsonRenderer and make methods sta…
juliawong Jan 19, 2015
1c2490c
Made geometry arrays and coordinates final
juliawong Jan 19, 2015
4e9b038
Added constants for geometries
juliawong Jan 19, 2015
d9dd85e
Minor refactor of GeoJsonRenderer
juliawong Jan 19, 2015
0beb8fb
Renamed the GeoJsonMultiLineStringTest and added tests/
juliawong Jan 19, 2015
44f0b6a
Renamed GeoJsonMultiPolygonTest and added tests
juliawong Jan 19, 2015
058f49f
Started on implementation for GroundOverlay
lchans Jan 20, 2015
5b7b049
Merge conflict
lchans Jan 20, 2015
d7e7933
GeoJsonParser and GeoJsonRenderer are now package protected. Ran refo…
juliawong Jan 20, 2015
a58e528
Fixed tests failing due to IBitmapDescriptorFactory
juliawong Jan 20, 2015
90f456d
Cleaned up comments
lchans Jan 20, 2015
479fae4
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Jan 20, 2015
7a6438f
Added more GeoJsonFeature tests
juliawong Jan 20, 2015
91d6fce
Removed TODO
juliawong Jan 20, 2015
a9c3d1b
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 20, 2015
624efa7
Modified exception throwing in the parser. Added tests.
juliawong Jan 20, 2015
7be2a93
getFeatures returns an Iterable
juliawong Jan 20, 2015
4273c58
Reformat and minor refactor of code. Changed all iterators to iterabl…
juliawong Jan 21, 2015
045a09e
Fixed error preventing inner containers from being created.
juliawong Jan 21, 2015
1f01fd7
Implemented parsing of extended data in features
juliawong Jan 21, 2015
8d76802
Implemented parsing of extended data in containers
juliawong Jan 21, 2015
8557c02
Implemented parsing and adding GroundOverlay onto the map
juliawong Jan 23, 2015
a4a6df2
Added toString methods
juliawong Jan 23, 2015
e2d3d87
Throws an error if the image could not be retrieved
lchans Jan 26, 2015
02222a7
Throwing error if no text found in BalloonStyle
lchans Jan 26, 2015
9a564d1
Added Polygon tests, fixed error where not existent inner boundaries …
lchans Jan 27, 2015
1b91a53
Added tests for KML geometry objects and basic KML style functions
lchans Jan 27, 2015
3bfb5da
Added more tests for styles
lchans Jan 27, 2015
cb2dd27
Added tests for container parser, changed visibility of containers to…
lchans Jan 27, 2015
278c2d3
Support for inline styles in placemarks
juliawong Jan 27, 2015
486ccee
Updated demo files
juliawong Jan 27, 2015
fe716d6
Removed KmlContainerInterface and updated references to it
juliawong Jan 27, 2015
2facf23
Added tests for KmlContainerParser, focusing mainly on nested containers
lchans Jan 27, 2015
29850b8
Inline styles stored for containers. Separated from shared styles.
juliawong Jan 27, 2015
2135e3f
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 27, 2015
4445420
One LruCache being used for marker icons and ground overlays
juliawong Jan 27, 2015
529de63
Added additional tests for nested folders
lchans Jan 27, 2015
b50c743
Removed inline styles for containers, not supported in KML
juliawong Jan 27, 2015
c9f293a
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 27, 2015
8d6142f
Added seperate method for creating a latlngbound for better readability
lchans Jan 27, 2015
d1cc4df
Changed FeatureParser from if to else if statements
lchans Jan 27, 2015
c5da7be
Added testing for feature, now fetches test files from a raw resource…
lchans Jan 27, 2015
dfb8b3c
Refactored part of KmlLayer into KmlRenderer
juliawong Jan 27, 2015
6bae8b8
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 27, 2015
62bfa59
Added tests for multigeometry and added a hasProperties method
lchans Jan 28, 2015
747f165
Fixed up a few javadoc commments and also deleted code so that it is …
lchans Jan 28, 2015
d123cf7
Added tests for multiple features in a container
lchans Jan 28, 2015
e1ae3fa
Implemented inline styles
juliawong Jan 28, 2015
8ee262d
Added extended data test
lchans Jan 28, 2015
492c2ae
Color mode working for markers
lchans Jan 28, 2015
1e085cf
Seperated methods, now has inlinestyle methods
lchans Jan 28, 2015
23933d2
Refractored variable names
lchans Jan 28, 2015
67f84a0
Added style map tests
lchans Jan 29, 2015
4fbce85
Support for inline icon URLs and scale
juliawong Jan 29, 2015
536b868
Refractored variable names
lchans Jan 29, 2015
6760590
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Jan 29, 2015
e664ca2
Added more ground overlay tests
lchans Jan 29, 2015
fe3c5d5
Added testing for cdata entities
lchans Jan 29, 2015
08510fd
Changed to nextToken
lchans Jan 29, 2015
1d54a89
Changed implemented of createGroundOverlay to be seperate create and …
lchans Jan 29, 2015
1158331
Ground Overlay stores color
lchans Jan 29, 2015
09d300f
Removal of GroundOverlays, parse objects once, download images once
juliawong Jan 29, 2015
e56c9ce
Added more javadoc
lchans Jan 29, 2015
0e83a3a
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Jan 29, 2015
fb20a66
Point displays an info window even if balloonstyle is not set (it dis…
lchans Jan 30, 2015
0052fce
Closed the stream
juliawong Jan 30, 2015
fffb80d
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 30, 2015
ea8ccbc
Using additional hashmap to assign styles
juliawong Jan 30, 2015
2d797bb
Changed javadoc comments
lchans Jan 30, 2015
5cb9103
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Jan 30, 2015
96729b0
Minor modification to allow for style maps to be updated only when re…
juliawong Jan 30, 2015
9e4e915
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Jan 30, 2015
5c4c618
Reformat parser
juliawong Jan 30, 2015
59e69be
Add images to the cache regardless of layer visibility
juliawong Jan 30, 2015
158ad5b
Updated Javadoc for KmlLayer
juliawong Jan 30, 2015
64171d3
Added more JavaDoc
lchans Jan 30, 2015
6a0e7b8
Small change from getFolders to getContainers
lchans Feb 1, 2015
d92649a
New KML file with incorrect balloons
juliawong Feb 2, 2015
ba42830
Fixed bug where info windows had the same text
lchans Feb 2, 2015
ebcbc74
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Feb 2, 2015
f157c3f
Removed unnecessary javadoc comments, also refractored START_TAG
lchans Feb 2, 2015
e9ee72a
Cleaned up minor errors
lchans Feb 2, 2015
2cbd6a5
Added more tests for invalid features
juliawong Feb 2, 2015
5bc9c40
Added skeleton for renderer
juliawong Feb 2, 2015
2dcbc90
Parser classes take in the parser through the method not the construc…
lchans Feb 2, 2015
b2604cb
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Feb 2, 2015
8ae1483
Added tests for valid features, minor clean up
juliawong Feb 2, 2015
5278496
Changed constructors of KmlContainer to take all properties, eliminat…
lchans Feb 2, 2015
3781da1
Changed featureparser methods to static
lchans Feb 2, 2015
02287e0
Removed constructor in KmlFeatureParser, now has all static methods
lchans Feb 2, 2015
b6e8167
Minor editng of primative types
lchans Feb 2, 2015
4b3a82b
Features can be accessed when not added to the map
juliawong Feb 2, 2015
0039f97
Minor refactor
juliawong Feb 2, 2015
d93103f
Add tests for the layer
juliawong Feb 2, 2015
dd7f050
createGroundOverlay is now static, removed set methods for KmlGroundO…
juliawong Feb 2, 2015
8f81f53
Started implementing static methods for style
juliawong Feb 2, 2015
581273e
Fixed calling of static method
juliawong Feb 2, 2015
5094e8a
Added a demo for GeoJson
lchans Feb 2, 2015
4ad6f51
Added a demo for GeoJson
lchans Feb 2, 2015
a3ce6ca
Added a GeoJson demo
lchans Feb 2, 2015
718f849
Parsing methods are now static, minor refactor of code.
juliawong Feb 2, 2015
00c844e
Updated test
juliawong Feb 2, 2015
9a2aeb2
Features are now read from the renderer when adding and removing
juliawong Feb 3, 2015
bce41d9
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Feb 3, 2015
0c154b7
Added get, set, has and remove methods for the properties
juliawong Feb 3, 2015
ab819b8
Made Style interface local
juliawong Feb 3, 2015
faa3c25
More descriptive addDataToLayer Javadoc
juliawong Feb 3, 2015
df6fa24
Rotation working for GroundOverlay
lchans Feb 3, 2015
624ef01
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Feb 3, 2015
f9396cd
Created a shorter way of implementing GroundOverlay - Values now stor…
lchans Feb 3, 2015
ac773ef
Modified tests to use new property methods. Added an iterable to get all
juliawong Feb 3, 2015
4a87434
Added javadoc for groundoverlay, also changed methods from public to …
lchans Feb 3, 2015
3b564f1
Always remove previous map objects before adding new ones
juliawong Feb 3, 2015
6b8fd78
Reverted ground overlay methods to public, color stored in proprties …
juliawong Feb 3, 2015
967462a
Minor refactor of putting color in properties hashmap
juliawong Feb 3, 2015
7fea8cc
KML reads color in the reverse order, reversed the string storing the…
lchans Feb 3, 2015
40bf540
Cleaned up code in KmlRenderer
lchans Feb 3, 2015
50da4fd
Reverted renderer, added demo files and demo classes
juliawong Feb 3, 2015
1bdf284
Visibility not working
lchans Feb 4, 2015
a1023be
Fixed visibility, germany.kml was setting initial visibility to 0
lchans Feb 4, 2015
eedf8fe
:cow: Demo files
juliawong Feb 4, 2015
1c47eaf
Revert ":cow: Demo files"
juliawong Feb 4, 2015
d050f82
Redo Javadoc
juliawong Feb 4, 2015
7d63284
Fixed visibility of ground overlay - now inherits visibility of the c…
lchans Feb 4, 2015
2404538
Refractored code
lchans Feb 4, 2015
687ebf6
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Feb 4, 2015
070856d
Log error when URL cannot be found
juliawong Feb 4, 2015
6458f63
Cleaned up code when scaling bitmap
lchans Feb 4, 2015
185e1a9
Geometry classes accept List instead of ArrayList
juliawong Feb 5, 2015
1820b34
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Feb 5, 2015
fe5c31a
Implementations of GeoJsonGeometry inherit the javadoc
juliawong Feb 5, 2015
4123900
Updated Javadoc to reflect changes to a list
juliawong Feb 5, 2015
ce3a1d3
Renamed add and remove layer methods
juliawong Feb 5, 2015
0f6e274
Removed demo files that weren't needed and updated the manifest
juliawong Feb 5, 2015
bd64770
Changed type for coordintaes. Overcomes type erasure.
juliawong Feb 5, 2015
58a9cb6
Updated Javadoc, removed getFeatureById and updated demo
juliawong Feb 5, 2015
369ba87
Seperated getter styles into static methods
lchans Feb 5, 2015
37d635b
Seperated getter styles into static methods
lchans Feb 5, 2015
a5a48e6
Fixed JavaDoc for KMLStyle
lchans Feb 5, 2015
82eff66
Redid Javadoc and refactor. Modified behaviour of styles for the GeoJ…
juliawong Feb 6, 2015
a7413fb
Fixed up KML Javadoc
lchans Feb 6, 2015
0006b9c
Removed TODO
juliawong Feb 6, 2015
4ee566e
Throw IAE if default styles are set to null
juliawong Feb 6, 2015
897b1e6
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Feb 6, 2015
2c8505e
Added code example for the GeoJsonLayer
juliawong Feb 6, 2015
38d82de
Added units to the Javadoc for GeoJSON styles
juliawong Feb 6, 2015
f28de17
Added a demo for a KML file
lchans Feb 6, 2015
0caa16a
:tada: KML Download from URL WORKS!
juliawong Feb 6, 2015
9f0dbd4
Refactor method names - removal of words nested and Kml
juliawong Feb 8, 2015
8419eeb
Renamed method to add layer to addLayer()
juliawong Feb 8, 2015
d84b68c
Refactor to allow for null styles in GeoJsonFeature
juliawong Feb 9, 2015
33224ef
Changed property to store in Kml Feature
lchans Feb 9, 2015
0ccb0d5
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
lchans Feb 9, 2015
3991d3c
Color supported in format of AABBGGRR and BBGGRR
lchans Feb 9, 2015
6a13bf4
Minor refactor of Javadoc
juliawong Feb 9, 2015
c262229
Merge branch 'new' of https://github.com/juliawong/android-maps-utils…
juliawong Feb 9, 2015
c76f9f0
Update demos with refactored method names
juliawong Feb 9, 2015
5c4c3c9
Deleting KML utility for GeoJSON branch
juliawong Feb 9, 2015
eee7b39
Modified demo files
juliawong Feb 9, 2015
208c0b1
Remove demo files
juliawong Feb 9, 2015
3a96fe6
Revert changes in GradientTest
juliawong Feb 9, 2015
ee49bc5
Revert change to GradientTest
juliawong Feb 9, 2015
4acac73
Added links to style classes
juliawong Feb 9, 2015
9b99b5e
Removed KmlDemoActivity
juliawong Feb 9, 2015
55fc1bf
Added new demo using GOOGLE letters
juliawong Feb 9, 2015
69e4ebe
Removed KML layout
juliawong Feb 10, 2015
742e250
Revert changes to Heatmaps Demo
juliawong Feb 10, 2015
475b8b1
Revert Heatmaps Places Demo
juliawong Feb 10, 2015
04fd895
Updated name of GeoJSON demo
juliawong Feb 10, 2015
391fa93
Removed if statement that didn't do anything
juliawong Feb 10, 2015
fba7915
fixed typo in Javadoc
juliawong Feb 10, 2015
39fc096
Updated demo
juliawong Feb 10, 2015
85cb778
Added earthquake demo
juliawong Feb 11, 2015
950aceb
Removed pre tags to make Javadoc inline for code examples
juliawong Feb 11, 2015
090b330
Update Javadoc
juliawong Feb 11, 2015
be9d004
Update Javadoc
juliawong Feb 11, 2015
225f5b8
Improved Javadoc description of GeoJsonLineString
juliawong Feb 11, 2015
6e0033e
Replace & with &
juliawong Feb 11, 2015
a2bed63
Ran reformatter on GeoJSON utility to prepare for pull request
juliawong Feb 11, 2015
448a928
Style regex is now a string array, updated tests to match
juliawong Feb 11, 2015
bfaf396
Added a check for place property
juliawong Feb 11, 2015
075579c
Made method static
juliawong Feb 11, 2015
a4f24f5
Added flag to check if layer is on map
juliawong Feb 11, 2015
712fed0
Updated javadoc for renamed mathod
juliawong Feb 11, 2015
c1cd7d1
Layers can only be added and removed once
juliawong Feb 11, 2015
f3b8d0c
Merge https://github.com/googlemaps/android-maps-utils into geojson
juliawong Feb 11, 2015
8ff082e
Modified Javadoc
juliawong Feb 11, 2015
920e5c2
Refactored renderer and added javadoc
juliawong Feb 11, 2015
470b2d0
Redid default styles. No set default style methods. Changes to defaul…
juliawong Feb 12, 2015
a63d708
Minor change to demo
juliawong Feb 12, 2015
6c2ff42
Remove unused demo file
juliawong Feb 12, 2015
5b7fae8
Ran reformatter on code to prepare for PR
juliawong Feb 12, 2015
cc9eac7
Ran reformatter on demo to prepare for PR
juliawong Feb 12, 2015
5b85756
Revert AndroidManifext.xml
juliawong Feb 13, 2015
dcabe01
Revert again
juliawong Feb 13, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<activity android:name=".TileProviderAndProjectionDemo"/>
<activity android:name=".HeatmapsDemoActivity"/>
<activity android:name=".HeatmapsPlacesDemoActivity"/>
<activity android:name=".GeoJsonDemoActivity"/>

</application>

Expand Down
4 changes: 2 additions & 2 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ dependencies {
compile project(':library')
// Or, fetch from Maven:
// compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.google.android.gms:play-services-maps:6.+'
compile 'com.google.android.gms:play-services:6.+'
}

android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
buildToolsVersion "21.1.1"

sourceSets {
main {
Expand Down
18 changes: 18 additions & 0 deletions demo/res/layout/geojson_demo.xml
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>
3 changes: 3 additions & 0 deletions demo/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<string name="attrib_format">Data from &lt;a href = "%s">data.gov.au&lt;/a>, modified under &lt;a href = \"http://creativecommons.org/licenses/by/3.0/au/\">CC BY 3.0 AU&lt;/a></string>
<string name="police_stations_url">http://data.gov.au/dataset/police-station-locations/resource/76110b24-0f0a-4c29-9583-3f99eaba486c</string>
<string name="medicare_url">http://data.gov.au/dataset/location-of-medicare-offices/resource/5d38e1be-4011-49c4-8b8b-75405eeb1088</string>
<string name="remove">Remove</string>
<string name="add">Add</string>
<string name="visibility">Toggle Vis</string>
<string-array name="heatmaps_datasets_array">
<item>@string/police_stations</item>
<item>@string/medicare</item>
Expand Down
131 changes: 131 additions & 0 deletions demo/src/com/google/maps/android/utils/demo/GeoJsonDemoActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
package com.google.maps.android.utils.demo;

import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.maps.android.geojson.GeoJsonFeature;
import com.google.maps.android.geojson.GeoJsonLayer;
import com.google.maps.android.geojson.GeoJsonPointStyle;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.AsyncTask;
import android.util.Log;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;

public class GeoJsonDemoActivity extends BaseDemoActivity {

private final static String mLogTag = "GeoJsonDemo";

// GeoJSON file to download
private final String mGeoJsonUrl
= "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson";

private GeoJsonLayer mLayer;

/**
* Assigns a color based on the given magnitude
*/
private static float magnitudeToColor(double magnitude) {
if (magnitude < 1.0) {
return BitmapDescriptorFactory.HUE_CYAN;
} else if (magnitude < 2.5) {
return BitmapDescriptorFactory.HUE_GREEN;
} else if (magnitude < 4.5) {
return BitmapDescriptorFactory.HUE_YELLOW;
} else {
return BitmapDescriptorFactory.HUE_RED;
}
}

protected int getLayoutId() {
return R.layout.geojson_demo;
}

@Override
protected void startDemo() {
DownloadGeoJsonFile downloadGeoJsonFile = new DownloadGeoJsonFile();
// Download the GeoJSON file
downloadGeoJsonFile.execute(mGeoJsonUrl);
}

/**
* Adds a point style to all features to change the color of the marker based on its magnitude
* property
*/
private void addColorsToMarkers() {
// Iterate over all the features stored in the layer
for (GeoJsonFeature feature : mLayer.getFeatures()) {
// Check if the magnitude property exists
if (feature.hasProperty("mag") && feature.hasProperty("place")) {
double magnitude = Double.parseDouble(feature.getProperty("mag"));

// Get the icon for the feature
BitmapDescriptor pointIcon = BitmapDescriptorFactory
.defaultMarker(magnitudeToColor(magnitude));

// Create a new point style
GeoJsonPointStyle pointStyle = new GeoJsonPointStyle();

// Set options for the point style
pointStyle.setIcon(pointIcon);
pointStyle.setTitle("Magnitude of " + magnitude);
pointStyle.setSnippet("Earthquake occured " + feature.getProperty("place"));

// Assign the point style to the feature
feature.setPointStyle(pointStyle);
}
}
}

private class DownloadGeoJsonFile extends AsyncTask<String, Void, JSONObject> {

@Override
protected JSONObject doInBackground(String... params) {
try {
// Open a stream from the URL
InputStream stream = new URL(params[0]).openStream();

String line;
StringBuilder result = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

while ((line = reader.readLine()) != null) {
// Read and save each line of the stream
result.append(line);
}

// Close the stream
reader.close();
stream.close();

// Convert result to JSONObject
return new JSONObject(result.toString());
} catch (IOException e) {
Log.e(mLogTag, "GeoJSON file could not be read");
} catch (JSONException e) {
Log.e(mLogTag, "GeoJSON file could not be converted to a JSONObject");
}
return null;
}

@Override
protected void onPostExecute(JSONObject jsonObject) {
if (jsonObject != null) {
// Create a new GeoJsonLayer, pass in downloaded GeoJSON file as JSONObject
mLayer = new GeoJsonLayer(getMap(), jsonObject);
// Add the layer onto the map
addColorsToMarkers();
mLayer.addLayerToMap();
}
}


}
}

3 changes: 3 additions & 0 deletions demo/src/com/google/maps/android/utils/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
public class MainActivity extends Activity implements View.OnClickListener {
private ViewGroup mListView;

//Comment to see if I can push to the repository

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -26,6 +28,7 @@ protected void onCreate(Bundle savedInstanceState) {
addDemo("Generating tiles", TileProviderAndProjectionDemo.class);
addDemo("Heatmaps", HeatmapsDemoActivity.class);
addDemo("Heatmaps with Places API", HeatmapsPlacesDemoActivity.class);
addDemo("GeoJSON Layer", GeoJsonDemoActivity.class);
}

private void addDemo(String demoName, Class<? extends Activity> activityClass) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Sat Dec 20 10:27:44 MST 2014
#Wed Dec 17 14:51:18 EST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 6 additions & 1 deletion library/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
package="com.google.maps.android">
<uses-sdk android:minSdkVersion="9"/>
<!-- https://groups.google.com/group/adt-dev/browse_thread/thread/c059c0380998092b/6720093fb40fdaf9 -->
<application/>
<application>
<meta-data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need this in the library.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added to allow for unit tests to extend the AndroidTestCase. In particular, we need this to test the changing of icons for markers.

android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

</application>
</manifest>
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.android.tools.build:gradle:1.0.0-rc4'
}
}

Expand All @@ -16,13 +16,13 @@ archivesBaseName = 'android-maps-utils'
group = 'com.google.maps.android'

dependencies {
compile 'com.google.android.gms:play-services-maps:6.5.87'
compile 'com.google.android.gms:play-services:6.+'
}


android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
buildToolsVersion "21.0.1"

sourceSets {
main {
Expand Down
Loading