Snap to crossing between lines in OpenLayersHow to snap lines to points automatically?how to snap two line vertex in two different layers used in QGISSnap (editing tools) in ArcGIS not working properlyHow to snap a road network to a hexagonal grid in QGIS?Snap lines to polygon verticies at interscetionQGIS snap questionOpenLayers 4 between geometrySnap lines based on hierarchyHow to snap to intersection of lines with Classic snapping?PostGIS snap line segment endpoint to closest other line segment
XeLaTeX and pdfLaTeX ignore hyphenation
How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?
Download, install and reboot computer at night if needed
Why has Russell's definition of numbers using equivalence classes been finally abandoned? ( If it has actually been abandoned).
Theorems that impeded progress
A function which translates a sentence to title-case
Validation accuracy vs Testing accuracy
Copenhagen passport control - US citizen
Shell script can be run only with sh command
What would the Romans have called "sorcery"?
I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine
How can I fix this gap between bookcases I made?
Why are 150k or 200k jobs considered good when there are 300k+ births a month?
How to add power-LED to my small amplifier?
Book about a traveler who helps planets in need
Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)
What defenses are there against being summoned by the Gate spell?
Why are only specific transaction types accepted into the mempool?
Why is "Reports" in sentence down without "The"
Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)
Why don't electron-positron collisions release infinite energy?
Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?
New order #4: World
Can I interfere when another PC is about to be attacked?
Snap to crossing between lines in OpenLayers
How to snap lines to points automatically?how to snap two line vertex in two different layers used in QGISSnap (editing tools) in ArcGIS not working properlyHow to snap a road network to a hexagonal grid in QGIS?Snap lines to polygon verticies at interscetionQGIS snap questionOpenLayers 4 between geometrySnap lines based on hierarchyHow to snap to intersection of lines with Classic snapping?PostGIS snap line segment endpoint to closest other line segment
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Is it possible to let the snap interaction snap to the crossing of two different lines (or polygons) in OpenLayers?
It can snap to vertices and lines between vertices, but I can't see a way to snap to the crossing of different geometries.
openlayers snapping
add a comment |
Is it possible to let the snap interaction snap to the crossing of two different lines (or polygons) in OpenLayers?
It can snap to vertices and lines between vertices, but I can't see a way to snap to the crossing of different geometries.
openlayers snapping
What is the nature of these lines/polygons? Can they be considered/combined to one geometry collection?
– TomazicM
Apr 3 at 16:33
No they are different polygons/lines. They might be combined temporarily for the snap calculation.
– Hansson
2 days ago
Then solution from @Mike should be accepted. Just take code from linesource2.clear();
onward.
– TomazicM
2 days ago
add a comment |
Is it possible to let the snap interaction snap to the crossing of two different lines (or polygons) in OpenLayers?
It can snap to vertices and lines between vertices, but I can't see a way to snap to the crossing of different geometries.
openlayers snapping
Is it possible to let the snap interaction snap to the crossing of two different lines (or polygons) in OpenLayers?
It can snap to vertices and lines between vertices, but I can't see a way to snap to the crossing of different geometries.
openlayers snapping
openlayers snapping
asked Apr 3 at 15:00
HanssonHansson
134
134
What is the nature of these lines/polygons? Can they be considered/combined to one geometry collection?
– TomazicM
Apr 3 at 16:33
No they are different polygons/lines. They might be combined temporarily for the snap calculation.
– Hansson
2 days ago
Then solution from @Mike should be accepted. Just take code from linesource2.clear();
onward.
– TomazicM
2 days ago
add a comment |
What is the nature of these lines/polygons? Can they be considered/combined to one geometry collection?
– TomazicM
Apr 3 at 16:33
No they are different polygons/lines. They might be combined temporarily for the snap calculation.
– Hansson
2 days ago
Then solution from @Mike should be accepted. Just take code from linesource2.clear();
onward.
– TomazicM
2 days ago
What is the nature of these lines/polygons? Can they be considered/combined to one geometry collection?
– TomazicM
Apr 3 at 16:33
What is the nature of these lines/polygons? Can they be considered/combined to one geometry collection?
– TomazicM
Apr 3 at 16:33
No they are different polygons/lines. They might be combined temporarily for the snap calculation.
– Hansson
2 days ago
No they are different polygons/lines. They might be combined temporarily for the snap calculation.
– Hansson
2 days ago
Then solution from @Mike should be accepted. Just take code from line
source2.clear();
onward.– TomazicM
2 days ago
Then solution from @Mike should be accepted. Just take code from line
source2.clear();
onward.– TomazicM
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
You can use turf.js to calculate the intersection points of linestrings and polygons, and use those, either in a second source or a feature collection, to control your snap interaction. Unfortunately turf.js works only on EPSG:4326 geometry and the point at which geometries intersect can different depending on how they are projected, so instead of reprojecting view coordinates to lon/lat I define a temporary projection where the view projection coordinates are scaled down small enough (to values < 1) to be treated as lon/lat by turf.js. Here's a working demo http://mikenunn.16mb.com/demo/linestring-intersects.html If you draw two or more intersecting linestrings (it won't catch self-intersecting lines) the intersection points will be highlighted (for non-demo use the second source does not need be shown on to the map) and the snap interaction snaps to them.
Here's the code used in the demo:
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers LineString Intersection</title>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
<script src="https://npmcdn.com/@turf/turf@5.1.6/turf.min.js"></script>
</head>
<body>
<div id="map" class="map"></div>
<script>
var raster = new ol.layer.Tile(
source: new ol.source.OSM()
);
var source = new ol.source.Vector();
var style = new ol.style.Style(
stroke: new ol.style.Stroke(
color: 'black',
width: 5
)
);
var vector = new ol.layer.Vector(
source: source,
style: style
);
var source2 = new ol.source.Vector();
var style2 = new ol.style.Style(
image: new ol.style.Circle(
fill: new ol.style.Fill(
color: 'red'
),
radius: 5
)
);
var vector2 = new ol.layer.Vector(
source: source2,
style: style2
);
var map = new ol.Map(
layers: [raster, vector, vector2],
target: 'map',
view: new ol.View(
center: [-11000000, 4600000],
zoom: 4
)
);
var viewProjection = map.getView().getProjection();
var smallProjection = new ol.proj.Projection(
code: 'small',
units: 'm'
);
ol.proj.addProjection(smallProjection);
var scale = ol.extent.getWidth(viewProjection.getExtent());
var smallTransform = function(coordinates, output, dimensions)
var dims = dimensions
var normalTransform = function(coordinates, output, dimensions)
var dims = dimensions
ol.proj.addCoordinateTransforms(viewProjection, smallProjection, smallTransform, normalTransform);
var format = new ol.format.GeoJSON();
source.on(['addfeature','changefeature','removefeature'], function()
source2.clear();
var features = source.getFeatures();
for (var i=0; i<features.length; i++)
var geom = features[i].getGeometry().getType();
if (geom == 'LineString'
);
var draw = new ol.interaction.Draw(
source: source,
type: 'LineString'
);
map.addInteraction(draw);
var snap = new ol.interaction.Snap(
source: source2,
pixelTolerance: 20
);
map.addInteraction(snap);
</script>
</body>
</html>
Thank you for you good answer, but I was hoping for a solution within OpenLayers. We use various projections and until now we have avoided turf because of its size. We might have an option to do the intersection crossing check on the backend that could provide a snap point vector layer.
– Hansson
2 days ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317657%2fsnap-to-crossing-between-lines-in-openlayers%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use turf.js to calculate the intersection points of linestrings and polygons, and use those, either in a second source or a feature collection, to control your snap interaction. Unfortunately turf.js works only on EPSG:4326 geometry and the point at which geometries intersect can different depending on how they are projected, so instead of reprojecting view coordinates to lon/lat I define a temporary projection where the view projection coordinates are scaled down small enough (to values < 1) to be treated as lon/lat by turf.js. Here's a working demo http://mikenunn.16mb.com/demo/linestring-intersects.html If you draw two or more intersecting linestrings (it won't catch self-intersecting lines) the intersection points will be highlighted (for non-demo use the second source does not need be shown on to the map) and the snap interaction snaps to them.
Here's the code used in the demo:
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers LineString Intersection</title>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
<script src="https://npmcdn.com/@turf/turf@5.1.6/turf.min.js"></script>
</head>
<body>
<div id="map" class="map"></div>
<script>
var raster = new ol.layer.Tile(
source: new ol.source.OSM()
);
var source = new ol.source.Vector();
var style = new ol.style.Style(
stroke: new ol.style.Stroke(
color: 'black',
width: 5
)
);
var vector = new ol.layer.Vector(
source: source,
style: style
);
var source2 = new ol.source.Vector();
var style2 = new ol.style.Style(
image: new ol.style.Circle(
fill: new ol.style.Fill(
color: 'red'
),
radius: 5
)
);
var vector2 = new ol.layer.Vector(
source: source2,
style: style2
);
var map = new ol.Map(
layers: [raster, vector, vector2],
target: 'map',
view: new ol.View(
center: [-11000000, 4600000],
zoom: 4
)
);
var viewProjection = map.getView().getProjection();
var smallProjection = new ol.proj.Projection(
code: 'small',
units: 'm'
);
ol.proj.addProjection(smallProjection);
var scale = ol.extent.getWidth(viewProjection.getExtent());
var smallTransform = function(coordinates, output, dimensions)
var dims = dimensions
var normalTransform = function(coordinates, output, dimensions)
var dims = dimensions
ol.proj.addCoordinateTransforms(viewProjection, smallProjection, smallTransform, normalTransform);
var format = new ol.format.GeoJSON();
source.on(['addfeature','changefeature','removefeature'], function()
source2.clear();
var features = source.getFeatures();
for (var i=0; i<features.length; i++)
var geom = features[i].getGeometry().getType();
if (geom == 'LineString'
);
var draw = new ol.interaction.Draw(
source: source,
type: 'LineString'
);
map.addInteraction(draw);
var snap = new ol.interaction.Snap(
source: source2,
pixelTolerance: 20
);
map.addInteraction(snap);
</script>
</body>
</html>
Thank you for you good answer, but I was hoping for a solution within OpenLayers. We use various projections and until now we have avoided turf because of its size. We might have an option to do the intersection crossing check on the backend that could provide a snap point vector layer.
– Hansson
2 days ago
add a comment |
You can use turf.js to calculate the intersection points of linestrings and polygons, and use those, either in a second source or a feature collection, to control your snap interaction. Unfortunately turf.js works only on EPSG:4326 geometry and the point at which geometries intersect can different depending on how they are projected, so instead of reprojecting view coordinates to lon/lat I define a temporary projection where the view projection coordinates are scaled down small enough (to values < 1) to be treated as lon/lat by turf.js. Here's a working demo http://mikenunn.16mb.com/demo/linestring-intersects.html If you draw two or more intersecting linestrings (it won't catch self-intersecting lines) the intersection points will be highlighted (for non-demo use the second source does not need be shown on to the map) and the snap interaction snaps to them.
Here's the code used in the demo:
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers LineString Intersection</title>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
<script src="https://npmcdn.com/@turf/turf@5.1.6/turf.min.js"></script>
</head>
<body>
<div id="map" class="map"></div>
<script>
var raster = new ol.layer.Tile(
source: new ol.source.OSM()
);
var source = new ol.source.Vector();
var style = new ol.style.Style(
stroke: new ol.style.Stroke(
color: 'black',
width: 5
)
);
var vector = new ol.layer.Vector(
source: source,
style: style
);
var source2 = new ol.source.Vector();
var style2 = new ol.style.Style(
image: new ol.style.Circle(
fill: new ol.style.Fill(
color: 'red'
),
radius: 5
)
);
var vector2 = new ol.layer.Vector(
source: source2,
style: style2
);
var map = new ol.Map(
layers: [raster, vector, vector2],
target: 'map',
view: new ol.View(
center: [-11000000, 4600000],
zoom: 4
)
);
var viewProjection = map.getView().getProjection();
var smallProjection = new ol.proj.Projection(
code: 'small',
units: 'm'
);
ol.proj.addProjection(smallProjection);
var scale = ol.extent.getWidth(viewProjection.getExtent());
var smallTransform = function(coordinates, output, dimensions)
var dims = dimensions
var normalTransform = function(coordinates, output, dimensions)
var dims = dimensions
ol.proj.addCoordinateTransforms(viewProjection, smallProjection, smallTransform, normalTransform);
var format = new ol.format.GeoJSON();
source.on(['addfeature','changefeature','removefeature'], function()
source2.clear();
var features = source.getFeatures();
for (var i=0; i<features.length; i++)
var geom = features[i].getGeometry().getType();
if (geom == 'LineString'
);
var draw = new ol.interaction.Draw(
source: source,
type: 'LineString'
);
map.addInteraction(draw);
var snap = new ol.interaction.Snap(
source: source2,
pixelTolerance: 20
);
map.addInteraction(snap);
</script>
</body>
</html>
Thank you for you good answer, but I was hoping for a solution within OpenLayers. We use various projections and until now we have avoided turf because of its size. We might have an option to do the intersection crossing check on the backend that could provide a snap point vector layer.
– Hansson
2 days ago
add a comment |
You can use turf.js to calculate the intersection points of linestrings and polygons, and use those, either in a second source or a feature collection, to control your snap interaction. Unfortunately turf.js works only on EPSG:4326 geometry and the point at which geometries intersect can different depending on how they are projected, so instead of reprojecting view coordinates to lon/lat I define a temporary projection where the view projection coordinates are scaled down small enough (to values < 1) to be treated as lon/lat by turf.js. Here's a working demo http://mikenunn.16mb.com/demo/linestring-intersects.html If you draw two or more intersecting linestrings (it won't catch self-intersecting lines) the intersection points will be highlighted (for non-demo use the second source does not need be shown on to the map) and the snap interaction snaps to them.
Here's the code used in the demo:
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers LineString Intersection</title>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
<script src="https://npmcdn.com/@turf/turf@5.1.6/turf.min.js"></script>
</head>
<body>
<div id="map" class="map"></div>
<script>
var raster = new ol.layer.Tile(
source: new ol.source.OSM()
);
var source = new ol.source.Vector();
var style = new ol.style.Style(
stroke: new ol.style.Stroke(
color: 'black',
width: 5
)
);
var vector = new ol.layer.Vector(
source: source,
style: style
);
var source2 = new ol.source.Vector();
var style2 = new ol.style.Style(
image: new ol.style.Circle(
fill: new ol.style.Fill(
color: 'red'
),
radius: 5
)
);
var vector2 = new ol.layer.Vector(
source: source2,
style: style2
);
var map = new ol.Map(
layers: [raster, vector, vector2],
target: 'map',
view: new ol.View(
center: [-11000000, 4600000],
zoom: 4
)
);
var viewProjection = map.getView().getProjection();
var smallProjection = new ol.proj.Projection(
code: 'small',
units: 'm'
);
ol.proj.addProjection(smallProjection);
var scale = ol.extent.getWidth(viewProjection.getExtent());
var smallTransform = function(coordinates, output, dimensions)
var dims = dimensions
var normalTransform = function(coordinates, output, dimensions)
var dims = dimensions
ol.proj.addCoordinateTransforms(viewProjection, smallProjection, smallTransform, normalTransform);
var format = new ol.format.GeoJSON();
source.on(['addfeature','changefeature','removefeature'], function()
source2.clear();
var features = source.getFeatures();
for (var i=0; i<features.length; i++)
var geom = features[i].getGeometry().getType();
if (geom == 'LineString'
);
var draw = new ol.interaction.Draw(
source: source,
type: 'LineString'
);
map.addInteraction(draw);
var snap = new ol.interaction.Snap(
source: source2,
pixelTolerance: 20
);
map.addInteraction(snap);
</script>
</body>
</html>
You can use turf.js to calculate the intersection points of linestrings and polygons, and use those, either in a second source or a feature collection, to control your snap interaction. Unfortunately turf.js works only on EPSG:4326 geometry and the point at which geometries intersect can different depending on how they are projected, so instead of reprojecting view coordinates to lon/lat I define a temporary projection where the view projection coordinates are scaled down small enough (to values < 1) to be treated as lon/lat by turf.js. Here's a working demo http://mikenunn.16mb.com/demo/linestring-intersects.html If you draw two or more intersecting linestrings (it won't catch self-intersecting lines) the intersection points will be highlighted (for non-demo use the second source does not need be shown on to the map) and the snap interaction snaps to them.
Here's the code used in the demo:
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers LineString Intersection</title>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
<script src="https://npmcdn.com/@turf/turf@5.1.6/turf.min.js"></script>
</head>
<body>
<div id="map" class="map"></div>
<script>
var raster = new ol.layer.Tile(
source: new ol.source.OSM()
);
var source = new ol.source.Vector();
var style = new ol.style.Style(
stroke: new ol.style.Stroke(
color: 'black',
width: 5
)
);
var vector = new ol.layer.Vector(
source: source,
style: style
);
var source2 = new ol.source.Vector();
var style2 = new ol.style.Style(
image: new ol.style.Circle(
fill: new ol.style.Fill(
color: 'red'
),
radius: 5
)
);
var vector2 = new ol.layer.Vector(
source: source2,
style: style2
);
var map = new ol.Map(
layers: [raster, vector, vector2],
target: 'map',
view: new ol.View(
center: [-11000000, 4600000],
zoom: 4
)
);
var viewProjection = map.getView().getProjection();
var smallProjection = new ol.proj.Projection(
code: 'small',
units: 'm'
);
ol.proj.addProjection(smallProjection);
var scale = ol.extent.getWidth(viewProjection.getExtent());
var smallTransform = function(coordinates, output, dimensions)
var dims = dimensions
var normalTransform = function(coordinates, output, dimensions)
var dims = dimensions
ol.proj.addCoordinateTransforms(viewProjection, smallProjection, smallTransform, normalTransform);
var format = new ol.format.GeoJSON();
source.on(['addfeature','changefeature','removefeature'], function()
source2.clear();
var features = source.getFeatures();
for (var i=0; i<features.length; i++)
var geom = features[i].getGeometry().getType();
if (geom == 'LineString'
);
var draw = new ol.interaction.Draw(
source: source,
type: 'LineString'
);
map.addInteraction(draw);
var snap = new ol.interaction.Snap(
source: source2,
pixelTolerance: 20
);
map.addInteraction(snap);
</script>
</body>
</html>
answered Apr 4 at 14:18
MikeMike
2,470139
2,470139
Thank you for you good answer, but I was hoping for a solution within OpenLayers. We use various projections and until now we have avoided turf because of its size. We might have an option to do the intersection crossing check on the backend that could provide a snap point vector layer.
– Hansson
2 days ago
add a comment |
Thank you for you good answer, but I was hoping for a solution within OpenLayers. We use various projections and until now we have avoided turf because of its size. We might have an option to do the intersection crossing check on the backend that could provide a snap point vector layer.
– Hansson
2 days ago
Thank you for you good answer, but I was hoping for a solution within OpenLayers. We use various projections and until now we have avoided turf because of its size. We might have an option to do the intersection crossing check on the backend that could provide a snap point vector layer.
– Hansson
2 days ago
Thank you for you good answer, but I was hoping for a solution within OpenLayers. We use various projections and until now we have avoided turf because of its size. We might have an option to do the intersection crossing check on the backend that could provide a snap point vector layer.
– Hansson
2 days ago
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317657%2fsnap-to-crossing-between-lines-in-openlayers%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is the nature of these lines/polygons? Can they be considered/combined to one geometry collection?
– TomazicM
Apr 3 at 16:33
No they are different polygons/lines. They might be combined temporarily for the snap calculation.
– Hansson
2 days ago
Then solution from @Mike should be accepted. Just take code from line
source2.clear();
onward.– TomazicM
2 days ago