tanweijiu / osmbonuspack

Automatically exported from code.google.com/p/osmbonuspack
0 stars 0 forks source link

CustomInfoWindow from KML file #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create OSMDroid MapView
2. Create an ArrayList of POIs (with NominatimPoiProvider)
3. Add a customInfoview to this Pois with a moreInfo Button (like Tutorial 2)
4. Add my pois overlay to a kml file and save it.
5. Load my local kml file

What is the expected output? What do you see instead?

POI visible on a map, with my custominfowindow that appears when press on a poi 
icon
When press a poi icon, a normal infowindow appears (without moreinfo button)

What version of the products are you using (Android SDK, osmdroid,
OSMBonusPack)?

Android 4.3.1
OsmDroid 4.1
OsmDroidBonusPack 4.2.9

Please provide any additional information below.

If I create a Poi overlay with custominfoWindows, add this overlay on the map 
(like tutorial 2) and launch my application appears my custom info windows. The 
problem appears when load poi from local kml file 

Original issue reported on code.google.com by giovanni...@gmail.com on 31 Mar 2014 at 4:59

GoogleCodeExporter commented 9 years ago
Just a first comment: for POIs created from NominatimPoiProvider, the "more 
info" button is useless, as there is no URL attached to such POIs... 

Now, if you get Wikipedia POIs with GeoNames, effectively, your strategy will 
not work. 
Going from POIs to Overlays, then to KML, is simple, but cannot ensure to keep 
all POIs information, and the behaviour you implemented with your 
custominfowindow. 

So, how should you proceed?

If you want to export your POI info in a KML file, I suggest that you build 
your KML content yourself directly from the POI array (not from Overlays). 
Basically, you create an empty KmlDocument, construct a KmlPlacemark for each 
POI, and put them in the KmlDocument.mKmlRoot. Then save the KmlDocument. 

And now, for POI loading: 
Load your KML file with a KmlDocument. 
Then, to have your custom InfoWindow with the "more info" button: 
Upgrade to OSMBonusPack v4.3. 
Then use the Styler (see Tutorial_4, "Advanced styling with the Styler"): 
Implement onPoint, so that for each POI Marker you can set your custom 
InfoWindow. 

Original comment by mathieu....@gmail.com on 1 Apr 2014 at 4:59

GoogleCodeExporter commented 9 years ago
Thanks for the reply.
In my application I want a brief description to appear when I click on the POI 
custominfowindow, while the click on the "more_info_button" opens an activity 
with a more detailed description. 
I'm going to implement the changes you suggested and I'll let you know. Another 
question: would it be possible to create a "custom provider POI" using a 
webservice to download a kml (or Json) file with the POI to be displayed? 
thank you very much

Original comment by giovanni...@gmail.com on 2 Apr 2014 at 8:41

GoogleCodeExporter commented 9 years ago
would it be possible to create a "custom provider POI" using a webservice to 
download a kml (or Json) file with the POI to be displayed? 

=> Yes, of course you can do that. 
You can also use the OSMBonusPack KmlDocument parser to load this KML file, and 
then create POIs from the KmlPlacemark objects. 

Original comment by mathieu....@gmail.com on 2 Apr 2014 at 10:48

GoogleCodeExporter commented 9 years ago
Hi,
I implemented the changes you suggested (screenshot 1 & 2) but, if I click on a 
marker I get a ClassCastException when casting the item in onOpen() method in 
customInfoWindow class. 
How should I proceed to get a POI item in onOpen() method? Or how should I do 
to obtain a POI object from a KmlPoint object?
Thanks, 
Giovanni

P.S: I attached some screenshots to better explain the problem.. 

Original comment by giovanni...@gmail.com on 3 Apr 2014 at 4:16

Attachments:

GoogleCodeExporter commented 9 years ago
Closed, as it neither a bug, not a feature request. 

Requests for help about implementating can be raised in StackOverflow (with 
osmdroid tag). 

Original comment by mathieu....@gmail.com on 25 Jul 2014 at 3:41