ibrierley / flutter_map_line_editor Goto Github PK
View Code? Open in Web Editor NEWA basic line/poly editor that works with flutter_map and dragmarkers.
License: MIT License
A basic line/poly editor that works with flutter_map and dragmarkers.
License: MIT License
Hi Ian,
We went thought this issue 2 years ago but now with updated Fluter and Map (3.0) I had problem to run LineEditor.
Originally I was using DragMaker from the package but they changed interface to I switched to yours.
It does compile but dragging does not work anymore ?
flutter_map_line_editor: ^4.0.2 flutter_map_dragmarker: ^4.1.2
Thanks for help in advance.
I get this error whenever I try to run the code.
How can I solve this? Thank you.
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_line_editor/flutter_map_line_editor.dart';
class _KmzMapState extends State<KmzMap> {
PolyEditor? polyEditor;
List<LatLng>? polygonToEdit;
@override
Widget build(BuildContext context) {
return FlutterMap(
children: [
TileLayer(...),
// GestureDetector + PolygonLayer that instantiates polyEditor onTap of existing polygon:
// polyEditor = PolyEditor(points: polygonToEdit!, callbackRefresh: () => setState(() {}))
PolygonLayer(
polygons: [Polygon(
color: Colors.purple,
points: polygonToEdit!,
)],
),
// ...
DragMarkers(markers: polyEditor!.edit()),
// ... DragMarkers is the last layer, there is only a RichAttributionLayer after it
]
);
}
}
In the screenshot, the drag marker can be interacted with, but it does not rebuild the PolygonLayer. No console output either, but callbackRefresh does get called.
Versions:
flutter_map: git+95ff0191981b87b24430ef434d7806e5a3017a50
flutter_map_dragmarker: 6.0.0
flutter_map_line_editor: 6.0.0
I am using bleeding-edge flutter_map as I require hit testing for the polygons. My app's map will be projecting multiple polygons that will be available to the user to edit and interact with as they please.
This looks really interesting - thanks for publishing it. Please add a license file to the package.
Thanks for your awesome jobs. really appreciate your dedication.
Everything works on i wanted to, but only filled colors.
I did exactly same things with your examples. I don't know why polygons don't have filled colors.
any advice would be great. thanks.
Hi, would it be possible to let the handler icons be widgets? That would make it possible to have better visible effects for example by stacking 2 different color icons.
Thanks for the great plugin, how I can move the polygon/polyline to another position by long press on it?
There's a quirk when using this on low zoom levels (I guess most people use a high zoom level for this) which I've never been quite happy with, and I feel like it should get fixed properly at some point.
Mid point markers can be offset slightly from their visual center. I suspect this is because of projections and a midway point of a LatLng isn't actually quite what we need. Again, we'll probably only notice this at low zoom levels where the effect is more pronounced.
I've tried a LatLngBounds.center, but actually I think this still has the same issue. What I suspect we need is actually to get the projection in pixels, so we have the screen space, then take the mid point, then unproject back into a LatLng.
If anyone fancies a challenge, it may be interesting to have a stab. This may need a bit more of a fundamental rejig, as I "think" it may need access to flutter_maps internals for the crs projection there, and original it was written to not need that.
Hi,
Your plugin is great and works great on Android/iOS.
How difficult is to make it work on Web too ?
Flutter_maps supports Web.
Thanks
Michal
So far I have only installed. Successfully. I had to remove flutter_map_dragmarker though because of:
[capturing] flutter pub get
Running "flutter pub get" in capturing...
Because every version of flutter_map_line_editor from git depends on flutter_map_dragmarker from git {url: https://github.com/ibrierley/flutter_map_dragmarker.git, ref: nullsafety, path: .} and capturing depends on flutter_map_dragmarker from git {url: https://github.com/ibrierley/flutter_map_dragmarker, ref: nullsafety, path: .}, flutter_map_line_editor from git is forbidden.
So, because capturing depends on flutter_map_line_editor from git, version solving failed.
pub get failed (1; So, because capturing depends on flutter_map_line_editor from git, version solving failed.)
exit code 1
But that will be fine once flutter_map_dragmarker is updated.
Please add support for flutter_map ^6.0.0
Because flutter_map_dragmarker >=5.0.0 depends on flutter_map ^5.0.0 and flutter_map_dragmarker <5.0.0 depends on latlong2 ^0.8.0, every version of flutter_map_dragmarker requires flutter_map
^5.0.0 or latlong2 ^0.8.0.
This code 'polyLines.add(testPolyline);' should not be placed in build(), because the build() method will be called multiple times, which will cause the testPolyline to be added multiple times and it can be placed in initState().
When multiple points are drawn and dragged several times, the map operation will become quite slow
I tried to take all but first and last marker, but it appears that they are ordered not along the line, but grouped by point type, so one would have to take that into account when deciding which points to remove, at which point this feels like I am getting too deep into implementation specific details of this library.
polyEditor.edit().sublist(1, polyEditor.edit().length - 2)
So I think it would be better if there is an option to disable the first and last marker. Perhaps two independent flags, as there may also be use cases where you only want to fixate one of the ends.
thank you for this amazing package! but can you add it to pub.dev packages because when I try to install it , it show me error because I use others dependencies that use flutter_map from pub.dev not from GitHub like u use in this package
Hi, I finally have been able to test this plugin properly (thanks a ton for it).
While it works nicely for lines, I incurred in an issue for polygons. Let's see if I am able to explain it.
If I load the polygon using the right coordinates (i.e. first and last equal), I get this:
which has the following problem, if editing the startpoint:
I am thinking about a possible workaround but nothing clean comes to my mind. I think the best would be to remove the last point during editing and then add it back once editing finished (it is anyways the same as the first).
The problem is that while the drag markers should have one less, the editing Polyline shown below the markers, needs to be closed, else one edge is missing.
And since the two share the same list of coordinates in order to be able to "move" consistently during dragging... I have no idea what would be best to do here. Do you have any idea? :-)
I would prefer a simple tap on a marker to remove it, but as the library currently uses long-press my proposal is to make this configurable.
This message has been sent to multiple plugin authors, so it is not personalised
As part of fleaflet/flutter_map#992 & fleaflet/flutter_map#927 (reply in thread), I (a documentation author) am contacting plugin authors to ensure the information about this plugin on the new documentation is correct; or alternatively, if this plugin is not yet on the existing list, to check whether you would like to add your plugin to the new documentation.
I would also like you to check you conform to these new rules:
Currently I have copied over the existing plugin descriptions, and you can see these here: https://flutter-map.vercel.app/plugins/list. Please note that this documentation is currently unapproved and should not be used unless otherwise directed, as some information may be incorrect or missing, or might change in the future. There is no ETA at the moment, but things seem to be moving along.
Should you wish for the description to remain the same as current on the page linked above, you do not have to reply, you can close this issue.
If you wish to change any information, please leave this issue open and add your reply as a comment.
flutter_map
maintainers do not take any responsibility for this message, I am the sole author.
On behalf of myself and the flutter_map
community thank you for your excellent plugin :).
Hi, I am trying to make the dragmarker size a user setting, so that one can choose it depending on the device (phone, tablet or pc).
Since I am using containers with decoration to make the handlers, I was experiencing issues with making the marker small (this didn't happen with the icons).
Then I saw that:
DragMarker(
point: this.points[indexClosure],
width: 40.0,
height: 40.0,
this width and height are hardcoded. Might this be the issue?
Is there a reason you chose to put here the size? Wouldn't the size come directly from the child widget? I am sure missign something here. Thanks for any insight.
Hi,
This plugin is really great but I can't make markers to drag. My map structure:
_flutterMap = FlutterMap(
options: _mapOptions,
mapController: _mapController,
layers: [
_mapStyle == MAP_STYLE_STREETS
? new TileLayerOptions(
urlTemplate:
"https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}",
)
: new TileLayerOptions(
urlTemplate:
"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}.jpg"),
new PolygonLayerOptions(
// concatenat ecurrent list with selected
polygons: _polygonsList,
),
new MarkerLayerOptions(
markers: _markersList,
),
new MarkerLayerOptions(
markers: _currentPosition != null ? [_currentPosition] : [],
),
new DragMarkerPluginOptions(markers: _polyEditor.edit()),
],
);
And MapOptions:
_mapOptions = new MapOptions(
// if position not known yet set center of US.
center: _position != null
? LatLng(_position.latitude, _position.longitude)
: LatLng(38.576525, -121.493217),
zoom: _zoom,
onTap: (_tapPosition, _latLng) => handleTap(_latLng),
onPositionChanged: (position, hasGesture) =>
handleMove(position, hasGesture),
plugins: [
DragMarkerPlugin(),
],
);
I get polyline with markers, I think I can even add new marker to the line but dragging does not work at all :(.
Thanks
This great package could be even more exciting if it allows to check if a custom point (a marker coordinates, a touch, a physical address, whatelse) is inside or outside a polygon, for instanse, using geodesy package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.