I have used leaflet.js to built a non geographic map using CRS
On top of this i have used leaflet draw control to manually draw lineString and then later saving them into mysql.
From the eg image above where path1, path2, path3 are different multiPoint lineString.
I wanted to know if it's possible to
find path between point A->B, B->A, A->C, C->A respectively, as its not gonna be a single lineString but combination of more than one depending where they intersect and if the intersecting line going towards the destination.
If A->D find the shortest route.
Related
I am trying to draw polygons using leaflet js and I have a geojson file that has co-ordinates of different regions in langLat [longitude,latitude] format. But leaflet polygon requires us to use the co-ordinates in latLang [latitude,longitude] format. So how do I revert the array elements considering there will be different multiple dimensions of arrays for different region?
I'm using Vue-leaflet component.
<l-polygon :lat-lngs="coordinates"></l-polygon>
I hope my question made sense. Any help would be appreciated.
I'm trying to move a geoJSON polygon (the outline of a city's administrative borders) from it's original location to another arbitrary one, maintaining its shape while respecting the Mercator projection. Much like how this site does it: https://thetruesize.com/
I've experimented with moving images around the map and those do respect the mercator projection when moved north, but this isn't ideal as the geoJSON would have to be converted to an image on the fly...
Is there an easy way to do this in mapbox without modifying the entire geoJSON to new coordinates?
Thanks!
transformTranslate from Turf.js can help you to translate GeoJSON features or geometries.
I sometimes had some problems when moving polygons across the globe with transformTranslate, so I wrote some function (repl.it) that behaves a bit differently.
How might I use the curve factories in d3-shape to smooth / interpolate geojson lines and polygons? As far as I understand the API, I can pass a list of coordinates, get an SVG line string back from:
var line = d3.line(coords).curve(d3.curveCatmullRom.alpha(0.5));
What I want is an array of coordinates that I can construct a LineString from.
I think I need to define a context that returns coordinates. There is plenty on rendering from geojson to svg linestrings but I can't find any information on rendering to geojson coordinates.
I am new to Leaflet and I would like to find out if how to create a fully interactive fictional map. I have an image that I would like to convert to a leaflet map. This image has a number of connections and points like a graph basically.
I want to first of all convert that image to the map, be able to hover over the points, highlight them and display information about them and also to create animations at some point but not immediately with the connections. There is also a requirement to display permanent labels next to each point.
Is that at all possible in Leaflet?
Is that at all possible in Leaflet?
Yes.
Start by reading the leaflet tutorial for non-geographical maps.
I'm trying to calculate and select the remaining area of a polygon when another polygon is placed inside it. I have an initial outer polygon. I then add a smaller polygon inside it which is up against the edge, sharing one or more sides with the outer polygon. I'm trying to get a new polygon path for the remaining unused area of the outer polygon.
As the 2 polygons share a boundary I'm looking to get a single polygon path for the new polygon rather than a complex polygon made up of an outer path and a hole/island.
Google Maps API Geometry library does have a method for detecting if a point is near the edge of a polygon - google.maps.geometry.poly.isLocationOnEdge(). I think that this is the way forward. I can get these points and push them into new arrays or use their indices. I just can't figure out how to use them to get to the remaining area.
Any help would be welcome whether it's Google Maps specific or just more general geometry theory.