Have issue in creating polygon on map - javascript

We are creating polygon on map it's brake because Road comes between two parcel.
I want to create single polygon. Selected parcel are show in this Polygon but Polygon brake when road comes in map.
I am using turf.union function for creating polygon.

Related

Can you display different map in a drawn polygon?

Is it possible in leaflet.js to draw a polygon on a map with one WMS and in this polygon display different WMS? (For example I want the user to be able to view a map with dark theme and than draw shapes on said map and in this shapes map would change to light theme.)

I want to Create Master Child Polygon

I want to Create Master Child Polygon and restrict the user to create a child polygon within the master polygon.
I have a master child polygons scenario in my bing map project. I want to show user only the master polygon area to draw the child polygon within the master polygon and not allowed to draw outside the master polygon.
Not 100% clear what you are looking for as drawing could mean to simple load a shape to the map or to draw a shape using a mouse or touch with drawing tools. For the first case you would need to filter out shapes that don't fit inside your polygon which is fairly easy to do using the spatial math module in Bing Maps V8. For the section case, I have put together a code sample: http://bingmapsv8samples.azurewebsites.net/#Restrict%20drawing%20to%20Polygon%20area

Selecting the unused area of a polygon as a new polygon in Google Maps API v.3

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.

Getting the centroid of each polygon from a GeoJson multipolygon in d3.js

I'm using d3.js for a non contiguous cartogram where countries are scaled depending on some data. I'm scaling from the centroid of each country/path in the svg generated from a GeoJson file, but this doesn't look good for countries described as a multipolygon, like the USA or Canada.
I would like to find the centroid of each polygon forming a multipolygon, so I can rescale without translating them. For example, when using the centroid of the USA, Alaska moves towards the right (in a mercator projection) while the rest moves up. Ideally, Alaska would be scaled from its own centroid, so it would stay in the same position.
Is it possible to iterate through each polygon in a multipolygon feature and get its centroid?
Thanks!
Finally I decided to split multipolygons in polygons by iterating over geometry.coordinates as #LarsKotthoff mentioned. With these polygons I created a new array of features with no Multipolygon types in it. Paths are added to the svg from this array, resulting in several polygons having the same id and name, i.e., several polygons for Canada with the same country abbreviation.
Thus you can keep using d3's path.centroid() to get the centroid of each polygon.

How to display millions of markers on google map (Using Web GL instead of Google Map Marker) with tool tips info on every marker when clicked?

I'm trying to make a web page which displaying a google map with so many markers (can be up to millions of markers) that looked up from data like json.
I try to make it using "google.maps.Marker" but it went very slowly (can be hang) on map rendering when there are so many markers. Then I found that it can be solved by using WEB GL
to render those markers on map like colored points on map. For now, I can make it until that step.
But there are still some problem I got, like below:
Right now I draw markers on map using Web GL like colored points, you can see like this link http://psousa.net/demos/webgl/ (I learned from it). How to change that point shape into triangle shape or circle shape instead of point/rectangle shape like that?
When every point of markers is clicked, there must be a mouse down event that will show some informations about that point (like name, description, etc.). How to implement that mouse event on every single of marker using Web GL?

Categories