caduandrade / vector_map_flutter

Vector map for Flutter
MIT License
31 stars 9 forks source link

Location and background map support #6

Open allasca opened 2 years ago

allasca commented 2 years ago

Thankyou for this awesome vector map project. :trophy: I just tested it on my android device from shapefile that I converted into geojson file. load 684 polygons without problem. using code from example that delayToRefreshResolution set to 0, I think the render is good, but maybe can be better? may I ask about location coordinate and background map like using google? or maybe future update? :smile: I really want to use it :+1:

caduandrade commented 2 years ago

Hi! Thank you.

As I come from Swing/JavaFX, I have focused my packages on Desktop. The objective of this project is to allow the creation of GIS applications for Web/Windows/Linux. I've noticed that performance drops on mobile. But this only happens with heavier geometries, I don't expect this use case on mobile. There are still some more difficult improvements to be made to try to decrease the time. Some improvements such as caching and geometry simplification algorithms like Douglas Peucker's, for example. I got to work a little bit on it but stopped to continue my other packages in Flutter. The good news is that time is on our side. Every year the devices get more robust.

About GoogleMaps, I didn't initially intend to support it because I saw that other packages already did. I focused on the vector map because it was missing. It's not impossible but it will also be relatively difficult as some things would have to be adapted like the zoom level and so on. This "raster" mode would have its own settings and limitations. But this improvement would take a long time. I can't dedicate myself to this right now, ok?

I just didn't release it as a "final release" because before, I wanted to implement more options for theming. Anyway, the API is already quite robust.

caduandrade commented 2 years ago

About the coordinate location, do you mean the coordinate over the mouse? If so, I could make similar the Hover Listener available. The limitation is that I would return the X,Y values in double relative to geometry. There would be no conversion between geographic coordinates and projected coordinates. You are probably using WGS84. If it were necessary to convert, I think there is already a package in pub.dev for that.

allasca commented 2 years ago

Thanks for your reply. Got your point. but I found hard (not what I want? / I am a noob) when come to labeling the polygon on other packages (others seem not support it, or just using marker) like your packages, also if be better if this can support multi labeling (get multiple keys)? or this package already can do that and I did'nt know? anyways, keep up the good work :beers:

for coordinate locations I meant show position of the phone to display on the layer.

caduandrade commented 2 years ago

Hi! Currently, the label mapping is just 1 to 1 through the labelKey property. I assume you want something like multiple labelKey right? Would you like to use different keys depending on the feature or even append Strings right?

If yes, perhaps in addition to the labelKey, it could optionally have a function for more complex cases. This function, when used, would override the labelKey. It could receive all mapped keys and return a String. In this case, you could create any rule.

Something like this:

typedef FeatureLabel = String Function(int featureId, Map<String, dynamic>? values);
    MapDataSource.geoJson(geoJson: geoJson,
        featureLabel: (featureId, values) {
      return '${values['name']} - ${values['address']}'; 
    });

What do you think?