Skip to content
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

UnsupportedOperationException when GeoJSON contains nested properties #111

Open
GoogleCodeExporter opened this issue Apr 6, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Try to parse geojson with nested "properties" section like
{"features":[{"geometry":{"coordinates":[36.8, 
55.9],"type":"Point"},"properties":{"address":"Ставропольская 
улица, дом 37, корпус 
1","id":1,"layer":2,"name":"Психоневрологический 
интернат № 11"},"type":"Feature"},{"geometry":{"coordinates":[37.8, 
56.9],"type":"Point"},"properties":{"count":4,"extent":{"bottom":1,"left":2,"rig
ht":3,"top":4},"layer":-1,"objects":{"0":{"count":4,"id":1,"layer":2}}},"type":"
Feature"}],"type":"FeatureCollection"}

What is the expected output? What do you see instead?
Parsing excepted.
Actualy UnsupportedOperationException throwed in KmlPlacemark line 97
String value = entry.getValue().getAsString();

What version of the products are you using (Android SDK, osmdroid,
OSMBonusPack)?
    compile 'org.osmdroid:osmdroid-android:4.2'
    compile 'org.slf4j:slf4j-simple:1.6.1'
    compile 'com.google.code.gson:gson:2.3';
    compile 'org.apache.commons:commons-lang3:3.3.2';
OSMBonusPack - 5.1

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 9 Feb 2015 at 6:38

@GoogleCodeExporter
Copy link
Author

Effectively, properties values which are not String are not supported, as 
stated in https://code.google.com/p/osmbonuspack/wiki/GeoJSON

For nested properties, would you like to have the whole value converted as a 
String? 
In your extent exemple, a String containing this:
{"bottom":1,"left":2,"right":3,"top":4}

Original comment by [email protected] on 9 Feb 2015 at 1:53

@GoogleCodeExporter
Copy link
Author

I think if I get String I have to wrap it in JsonElement again to parse and 
extract data, so it is a little redundant. It's better to have method returned 
nested properties as JsonElement.

Original comment by [email protected] on 9 Feb 2015 at 2:01

@GoogleCodeExporter
Copy link
Author

Not so simple: those properties are stored in KML Placemark Extended Data. 
Which are not coming from JSON but from XML. 
Convert nested properties as a String is the best I can reasonably do. 

Original comment by [email protected] on 10 Feb 2015 at 10:53

@GoogleCodeExporter
Copy link
Author

Code change just commited, with solution as described above. 
Not ideal, but better than a global parsing exception. 

Original comment by [email protected] on 21 Feb 2015 at 5:10

  • Changed state: Started

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant