Skip to content

Commit

Permalink
update docs, error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Apr 5, 2024
1 parent c3cfdc2 commit 1a6dfbe
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
16 changes: 9 additions & 7 deletions android/src/ti/map/TiUIMapView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1451,13 +1451,15 @@ public boolean onClusterItemClick(TiMarker tiMarker)

public void loadKml(KrollDict args)
{
TiBlob file = TiConvert.toBlob(args.get("file"));
try {
KmlLayer layer =
new KmlLayer(map, file.getInputStream(), TiApplication.getInstance().getApplicationContext());
layer.addLayerToMap();
} catch (Exception ex) {
Log.e(TAG, "Error: " + ex.getMessage());
if (map != null) {
TiBlob file = TiConvert.toBlob(args.get("file"));
try {
KmlLayer layer =
new KmlLayer(map, file.getInputStream(), TiApplication.getInstance().getApplicationContext());
layer.addLayerToMap();
} catch (Exception ex) {
Log.e(TAG, "Error: " + ex.getMessage());
}
}
}
}
7 changes: 7 additions & 0 deletions android/src/ti/map/ViewProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -1517,9 +1517,16 @@ public void setClusterAnnotation()
@Kroll.method
public void loadKml(KrollDict args)
{
if (!args.containsKeyAndNotNull("file")) {
Log.w(TAG, "file property is not set to a TiBlob");
return;
}

TiUIView view = peekView();
if (view instanceof TiUIMapView) {
((TiUIMapView) view).loadKml(args);
} else {
Log.e(TAG, "Map is not available");
}
}

Expand Down
31 changes: 22 additions & 9 deletions apidoc/Map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ description: |
<manifest>
<application>
<!-- Replace "YOUR_API_KEY" with the Google API key you obtained -->
<meta-data
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY" />
</application>
Expand Down Expand Up @@ -438,7 +438,7 @@ properties:
since: "6.3.0"

- name: FEATURE_TERRITORIES
summary: |
summary: |
The option that represents territorial boundaries such as a national border,
a state boundary, or a neighborhood.
type: Number
Expand All @@ -448,7 +448,7 @@ properties:
since: "12.0.0"

- name: FEATURE_PHYSICAL_FEATURES
summary: |
summary: |
The option that represents physical map features such as mountain ranges, rivers,
and ocean basins.
type: Number
Expand Down Expand Up @@ -484,14 +484,14 @@ properties:
osver: {ios: {min: "11.0"} }
exclude-platforms: [android]
since: "6.3.0"

- name: SEARCH_RESULT_TYPE_ADDRESS
summary: A value that indicates that search results include addresses.
type: Number
permission: read-only
osver: {ios: {min: "13.0"} }
since: "12.3.0"

- name: SEARCH_RESULT_TYPE_POINT_OF_INTEREST
summary: A value that indicates that search results include points of interest.
type: Number
Expand All @@ -518,7 +518,7 @@ methods:
summary: Returns a code to indicate whether Google Play Services is available on the device.
since: "3.1.1"
platforms: [android]

- name: search
summary: |
Uses the native `MKLocalSearchCompleter` class to search places for
Expand All @@ -537,6 +537,19 @@ methods:
platforms: [iphone, ipad, macos]
since: "12.3.0"

- name: loadKml
summary: |
Loads a KML file and displays the content on the map.
description: |
Check [Google Maps KML support](https://developers.google.com/maps/documentation/android-sdk/utility/kml#supported)
for more details.
parameters:
- name: file
summary: Ti.Blob of the KML file.
type: TiBlob
platforms: [android]
since: "12.4.0"

- name: geocodeAddress
summary: |
Resolve address details using the `CLGeocoder` to get information (e.g.
Expand Down Expand Up @@ -614,7 +627,7 @@ examples:
const mapView = Map.createView({
mapType: Map.NORMAL_TYPE,
region: {
region: {
latitude: 33.74511,
longitude: -84.38993,
latitudeDelta: 0.01,
Expand Down Expand Up @@ -769,7 +782,7 @@ examples:
The following example shows the MapKit based search request.
The options in `search` (2nd parameter) are optional, but improve
the accuracy of the results.
```javascript
import Map from 'ti.map';
Expand Down Expand Up @@ -817,4 +830,4 @@ properties:
- <Modules.Map.SEARCH_RESULT_TYPE_ADDRESS>
- <Modules.Map.SEARCH_RESULT_TYPE_POINT_OF_INTEREST>
- <Modules.Map.SEARCH_RESULT_TYPE_QUERY>
type: Array<Number>
type: Array<Number>

0 comments on commit 1a6dfbe

Please sign in to comment.