Removing polygon holes in OpenLayersJTS Polygon simplification without holesGeoserver : create a rasterized polygon / dynamic fill for polygons with features from databaseGeoserver and “inverting” a multiPolygon to dim the rest of a mapOpenLayers 3: Digitizing holes (donut polygons)St_delaunaytriangles polygon with holesAutomated way to create polygons from coloured mapgrid data to contoursFix slivers (Holes) between polygons ( generated after removing spikes)OGR multipolygon with holes modelHow to inverse the orientation of the holes coordinates of a polygon in geopandas
Are there any double stars that I can actually see orbit each other?
What is this welding tool I found in my attic?
What can the U.S. government do to prevent powerful people to get extremely favorable plea bargain deals like Jeff Epstein?
How to check the quality of an audio sample?
Are neural networks prone to catastrophic forgetting?
Does Google Maps take into account hills/inclines for route times?
Why did my rum cake turn black?
Password maker in c#
Filtering fine silt/mud from water (not necessarily bacteria etc.)
Cops: The Hidden OEIS Substring
Crowbar circuit causes unexpected behavior for op amp circuit
A DVR algebra with weird automorphisms
Why are Hobbits so fond of mushrooms?
Is Trump personally blocking people on Twitter?
Using ”as” after dialogue tags
<schwitz>, <zwinker> etc. Does German always use 2nd Person Singular Imperative verbs for emoticons? If so, why?
What would the EU do if an EU member declared war on another EU member?
Who Can Help Retag This?
The monorail explodes before I can get on it
QGIS Welcome page: What is 'pin to list' for?
How might the United Kingdom become a republic?
Why does Hellboy file down his horns?
How can an advanced civilization forget how to manufacture its technology?
Why do players in the past play much longer tournaments than today's top players?
Removing polygon holes in OpenLayers
JTS Polygon simplification without holesGeoserver : create a rasterized polygon / dynamic fill for polygons with features from databaseGeoserver and “inverting” a multiPolygon to dim the rest of a mapOpenLayers 3: Digitizing holes (donut polygons)St_delaunaytriangles polygon with holesAutomated way to create polygons from coloured mapgrid data to contoursFix slivers (Holes) between polygons ( generated after removing spikes)OGR multipolygon with holes modelHow to inverse the orientation of the holes coordinates of a polygon in geopandas
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I wrote some code for removal of polygon holes whose area value is under the hardcoded threshold.
source_g.getFeatures()[0].getGeometry().getPolygons().forEach(function(poly)
if(!(poly.getLinearRings().length<=1))
poly.getLinearRings().forEach(function(ring)
if(Math.abs(ring.getArea()) < 0.1)
ring.setCoordinates([])
)
;
)
The idea is to set coordinates of inner LinearRings
to []
, I tried to do that on the whole feature and it disappeared. But for LinearRings
it's not doing the same.
polygon openlayers holes
add a comment |
I wrote some code for removal of polygon holes whose area value is under the hardcoded threshold.
source_g.getFeatures()[0].getGeometry().getPolygons().forEach(function(poly)
if(!(poly.getLinearRings().length<=1))
poly.getLinearRings().forEach(function(ring)
if(Math.abs(ring.getArea()) < 0.1)
ring.setCoordinates([])
)
;
)
The idea is to set coordinates of inner LinearRings
to []
, I tried to do that on the whole feature and it disappeared. But for LinearRings
it's not doing the same.
polygon openlayers holes
add a comment |
I wrote some code for removal of polygon holes whose area value is under the hardcoded threshold.
source_g.getFeatures()[0].getGeometry().getPolygons().forEach(function(poly)
if(!(poly.getLinearRings().length<=1))
poly.getLinearRings().forEach(function(ring)
if(Math.abs(ring.getArea()) < 0.1)
ring.setCoordinates([])
)
;
)
The idea is to set coordinates of inner LinearRings
to []
, I tried to do that on the whole feature and it disappeared. But for LinearRings
it's not doing the same.
polygon openlayers holes
I wrote some code for removal of polygon holes whose area value is under the hardcoded threshold.
source_g.getFeatures()[0].getGeometry().getPolygons().forEach(function(poly)
if(!(poly.getLinearRings().length<=1))
poly.getLinearRings().forEach(function(ring)
if(Math.abs(ring.getArea()) < 0.1)
ring.setCoordinates([])
)
;
)
The idea is to set coordinates of inner LinearRings
to []
, I tried to do that on the whole feature and it disappeared. But for LinearRings
it's not doing the same.
polygon openlayers holes
polygon openlayers holes
edited Jul 4 at 10:52
Taras
3,2993 gold badges9 silver badges32 bronze badges
3,2993 gold badges9 silver badges32 bronze badges
asked Jul 4 at 9:49
GoranGoran
696 bronze badges
696 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The geometry is defined as an array of coordinates, not collections of Polygons and LinearRings, so what is returned by getPolygons()
and getLinearRings()
should be treated as clones and you will need to rebuild the geometry from coordinates
var geom = source_g.getFeatures()[0].getGeometry();
var geomCoords = [];
geom.getPolygons().forEach(function(poly)
var polyCoords = [];
poly.getLinearRings().forEach(function(ring, index)
if(index == 0 ;
geomCoords.push(polyCoords);
);
geom.setCoordinates(geomCoords);
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%2f327794%2fremoving-polygon-holes-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
The geometry is defined as an array of coordinates, not collections of Polygons and LinearRings, so what is returned by getPolygons()
and getLinearRings()
should be treated as clones and you will need to rebuild the geometry from coordinates
var geom = source_g.getFeatures()[0].getGeometry();
var geomCoords = [];
geom.getPolygons().forEach(function(poly)
var polyCoords = [];
poly.getLinearRings().forEach(function(ring, index)
if(index == 0 ;
geomCoords.push(polyCoords);
);
geom.setCoordinates(geomCoords);
add a comment |
The geometry is defined as an array of coordinates, not collections of Polygons and LinearRings, so what is returned by getPolygons()
and getLinearRings()
should be treated as clones and you will need to rebuild the geometry from coordinates
var geom = source_g.getFeatures()[0].getGeometry();
var geomCoords = [];
geom.getPolygons().forEach(function(poly)
var polyCoords = [];
poly.getLinearRings().forEach(function(ring, index)
if(index == 0 ;
geomCoords.push(polyCoords);
);
geom.setCoordinates(geomCoords);
add a comment |
The geometry is defined as an array of coordinates, not collections of Polygons and LinearRings, so what is returned by getPolygons()
and getLinearRings()
should be treated as clones and you will need to rebuild the geometry from coordinates
var geom = source_g.getFeatures()[0].getGeometry();
var geomCoords = [];
geom.getPolygons().forEach(function(poly)
var polyCoords = [];
poly.getLinearRings().forEach(function(ring, index)
if(index == 0 ;
geomCoords.push(polyCoords);
);
geom.setCoordinates(geomCoords);
The geometry is defined as an array of coordinates, not collections of Polygons and LinearRings, so what is returned by getPolygons()
and getLinearRings()
should be treated as clones and you will need to rebuild the geometry from coordinates
var geom = source_g.getFeatures()[0].getGeometry();
var geomCoords = [];
geom.getPolygons().forEach(function(poly)
var polyCoords = [];
poly.getLinearRings().forEach(function(ring, index)
if(index == 0 ;
geomCoords.push(polyCoords);
);
geom.setCoordinates(geomCoords);
answered Jul 4 at 10:20
MikeMike
3,5731 gold badge3 silver badges10 bronze badges
3,5731 gold badge3 silver badges10 bronze badges
add a comment |
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%2f327794%2fremoving-polygon-holes-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