liodali / osm_flutter

OpenStreetMap plugin for flutter
https://pub.dev/packages/flutter_osm_plugin
MIT License
235 stars 97 forks source link

Add custom information to GeoPoint marker #357

Open JaimeCosteira opened 1 year ago

JaimeCosteira commented 1 year ago

Hello,

I am currently trying to add information to my marker (description, tags, ..) that I can fetch when clicking the marker. My problem is that onGeoPointClicked returns a GeoPoint object and doesn't allow it to have more into rather than the latitude and longitude. Is there a way to override the callback onGeoPointClicked to have a CustomGeoPoint object ?

Thank you in advance !

liodali commented 1 year ago

you mean when you add marker to map you need to store some information and when you click on it you get those information ?

JaimeCosteira commented 1 year ago

Indeed !

I was able to create a custom GeoPoint class thats extends GeoPoint to give the information, but I cannot fetch the information on click.

jesussmile commented 1 year ago

Can you please share your code for custom GeoPoint class ?

liodali commented 1 year ago

sorry for late theoretically you can link additionnal information and geoPoint with lat/lon you can create Map<GeoPoint,AdditionnalInfo> when user click and get geoPoint fetch that Map to get the information need it

DmitriySimonov commented 1 year ago

Same problem! I have 10 markers, each has its own id, I want to display a message on click on the marker by id, and not by longitude and latitude. (because I can have 2 different markers with exactly the same longitude and width).

Please add String id to GeoPoint class!