Questions tagged [polygon]

For issues relating to the creation, manipulation and rendering of polygons in graphical user interfaces.

A polygon is a two-dimensional figure that is bounded by a closed path composed of a finite sequence of straight line segments. Polygons are drawn and rendered in graphical user interfaces.

4546 questions
22
votes
5 answers

In Google Map V3, how to put a label inside and above a polygon?

In Google Map V3, how to put a label inside and above a polygon? There's no label overlay as in V2 When I use the library maplabel, I can put the text inside, but not above, even if I specify an higher Z-index. Thanks Phil
trachy
  • 221
  • 1
  • 2
  • 5
21
votes
13 answers

What is the quickest way to find the shortest cartesian distance between two polygons

I have 1 red polygon say and 50 randomly placed blue polygons - they are situated in geographical 2D space. What is the quickest/speediest algorithim to find the the shortest distance between a red polygon and its nearest blue polygon? Bear in mind…
Vidar
  • 6,548
  • 22
  • 66
  • 96
21
votes
4 answers

Removing holes from polygons in R sf

Is there a way to remove holes from a polygon in R with the package sf? I would be interested in solutions that include other packages, too. Here's an example of a polygon with two holes. library(sf) outer = matrix(c(0,0,10,0,10,10,0,10,0,0),ncol=2,…
Duccio A
  • 1,402
  • 13
  • 27
21
votes
5 answers

Need a standalone Java library for performing spatial calculations on lat/lon data

I'm looking for a Java library that is capable of performing spatial calculations on sets of lat/lon data. Here are some of the functions that I'm looking for: Calculate the Great Circle distance between two points Determine if a point lies…
Jim Tough
  • 14,843
  • 23
  • 75
  • 96
20
votes
4 answers

Mongodb : Check if a point is inside a stored polygon

I'm new to the mongodb geolocation features. I stored some polygons that represent the country borders in a database along with the country name. Now what i would like to do is checking which country a point is in. For example if i give my own…
SkinyMonkey
  • 259
  • 1
  • 3
  • 7
20
votes
1 answer

Polygons nicely cropping ggplot2/ggmap at different zoom levels

I am playing with a spatial data set (mostly polygons over an area of a city) and I would like to produce different views, based on different levels of zoom. Everything is fine when I have the plot boundary box larger than the area that contains the…
Pascal
  • 395
  • 3
  • 9
19
votes
1 answer

ploting filled polygons in python

I have two matrices Tri and V for faces (Nx3) and vertices (Mx3) of polygons that I want to plot. Is there any matplotlib (or any alternative) way to do that? Something similar to Matlab command patch('faces',Tri,'vertices',V,'facecolor', …
ahmethungari
  • 2,089
  • 4
  • 19
  • 21
19
votes
3 answers

In PostGIS, how do I find all points within a polygon?

I am using PostgreSQL with the GIS extension to store map data, together with OpenLayers, GeoServer etc. Given a polygon, e.g. of a neighborhood, I need to find all LAT/LONG points stored in some table (e.g. traffic lights, restaurants) that are…
Shaul Dar
  • 881
  • 3
  • 10
  • 16
19
votes
2 answers

Google map: Add click listener to each polygon

I am working on a webapplication. I have a google map, where I add polygons from an array. I loop through that array and add the polygons to the map. I also need to add an event listener to the polygon click and alert the position of the…
Y2theZ
  • 10,162
  • 38
  • 131
  • 200
19
votes
7 answers

Find area of polygon from xyz coordinates

I'm trying to use the shapely.geometry.Polygon module to find the area of polygons but it performs all calculations on the xy plane. This is fine for some of my polygons but others have a z dimension too so it's not quite doing what I'd like. Is…
Jamie Bull
  • 12,889
  • 15
  • 77
  • 116
18
votes
5 answers

Placing a MapLabel on top of a Polygon in Google Maps V3

I'm trying to place a MapLabel on top of a Polygon in Google Maps V3. I've tried to set the MapLabel zIndex to 2 and the Polygon zIndex to 1 without any luck. Isn't this possible since the Polygon doesn't really follow zIndex? I've created a…
John
  • 251
  • 1
  • 3
  • 8
18
votes
2 answers

Fitting a convex polygon into another polygon

I am searching for an algorithm where I can check whether a convex polygon (shape 1) fits into another polygon (shape 2). My first research brought me to "Packing irregular shapes". This is in my opinion a little bit overkill. I only have one…
18
votes
2 answers

How do I add and remove Polygons on Google Maps v3?

I'm trying to show and remove polygons onto a Google Map, using v3 of the API. In my JavaScript, I've already got an MVCArray of some custom Lat-Longs. I'm trying to figure out how to add these polygons and then, based upon some other JavaScript…
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
18
votes
2 answers

How to divide irregular polygon into equal areas on Google map V2

I am developing an application for sampling Glebe for agriculture purpose. In That a user can select a a Glebe by tapping on map which will create a polygon according to the number of taps. I am able to create that polygon and able to get the area…
TheLittleNaruto
  • 8,325
  • 4
  • 54
  • 73
18
votes
1 answer

Is there a way to create a complex polygon shape from any image in CSS for use in regions property?

I'm trying to find a way to convert any black image into a polygon shape. The problem I'm trying to solve consists of two steps: Convert image into a polygon Fill the polygon with text I'm struggling with the first step. As I haven't found any…
achudars
  • 1,486
  • 15
  • 25