Comments (3)
Hi,
I'm afraid I can't help you with your issue. PolylineMeasure works with the latest version of Leaflet but it's just designed to work within "real world" maps. If you want to make it run also for phantasie maps you've to try to adapt the code for your world's coordinate system.
from leaflet.polylinemeasure.
Thanks for the fast response, that gives me some indication of the problem! I think Papyri handles this transformation on lines 54-78 of index.html ( https://github.com/jason-green-io/papyri/blob/master/template/index.html ) shown below.
Would you guess PolylineMeasure is most likely failing because the positive/negative quadrants of the coordinate system are arranged differently, or specifically because the world is "flat" and PolylineMeasure is trying to calculate an arc? If it's the latter case, maybe I can add an option flag for it to calculate "simple lines" without using the Great-Circle formulas.
Can you point me to the relevant portion of your code I might have to change, or at least to a starting point? I took a look at several other measuring plugins and yours is the best one I saw by far! If I can I'll adapt yours to work.
(Papyri index.html lines 54-78)
factor = 1 / 2 ** 16
L.CRS.pr = L.extend({}, L.CRS.Simple, {
projection: L.Projection.LonLat,
transformation: new L.Transformation(
factor,
64 * factor,
factor,
64 * factor),
scale: function(zoom) {
return Math.pow(2, zoom);
},
zoom: function(scale) {
return Math.log(scale) / Math.LN2;
},
distance: function(latlng1, latlng2) {
var dx = latlng2.lng - latlng1.lng,
dy = latlng2.lat - latlng1.lat;
return Math.sqrt(dx * dx + dy * dy);
},
infinite: true
});
from leaflet.polylinemeasure.
Well, the main function for drawing the arc lines is _"polylineArc" and the funtion to draw the arrows is _"drawArrow"
But since the plugin is using formulas which are restricted to the real-world coordinate system you have to create your own modified plugin to handle fictional coordinate systems. I won't implement them into PolylineMeasure, sorry. Thanks for understanding.
from leaflet.polylinemeasure.
Related Issues (20)
- error while deleting points after resume measure HOT 4
- [Suggestion] Have each pathline distance and in-out track available with `polylinemeasure:change`. HOT 1
- [Suggestion] Have the option to make the plugin on by deafult instead of off. HOT 3
- [Question] Could we get an example on how to use `measureControlClasses`? HOT 1
- Error after moving the point and clicking HOT 12
- Cursor pointer
- Cannot set properties of null (setting '_source') HOT 2
- Doesn't work with image overlays HOT 1
- how to grow vertex size? HOT 1
- Units not updating if changed while drawing
- Any way to use custom control to programmatically enable/disable measuring functionality? HOT 7
- How to integrate this plugin with Angular? HOT 1
- seed() is not a function HOT 2
- Use google map HOT 1
- Change the units to residential land measurement unit HOT 3
- Disable adding new points after you finish drawing HOT 1
- Evented leaflet objects that are added while polylinemeasure is toggled on are improperly handled HOT 2
- Get segment distance, headings and total distance HOT 2
- Add arrow colour option HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.polylinemeasure.