Is it possible to check if a polygon intersects with itself using Clipper? - intersection

Can I use Clipper to check if my polygon contour intersects with itself (if it is a complex or a simple polygon)?
I know that it does not make the polygon invalid, but in my case I want to avoid self intersecting polygons.

No, there's no function for that in the library.

Related

Regarding heat maps

http://www.amcharts.com/demos/selecting-multiple-areas-map/
Please see the above link map i want to make something like this could anyone please share the details of how i could make it moreover i have to make for my particular state how i could do all this.
I have tried few things with google fusion tables but didnt able to get this layout and the js file used in this is different how i can make my own
Thanks
There are certain steps that you need to follow to make this feature work:
First you have to define the borders of all the US states. This can be obtained by passing the lat/lng values of the borders. Please refer to this JS file which has the Lat/Lng of US states along the border. Draw Polygon using code.
var statesobj = {"AK": [new google.maps.LatLng(70.0187, -141.0205),
new google.maps.LatLng(70.1292, -141.7291),
new google.maps.LatLng(70.4515, -144.8163)]}
So, it's easy now. Loop on these lat/longs. And you can draw the polygons on every state of US.
Secondly, Consider all the regions/states drawn on the Google Maps as polygon. Then you have to pass to the polygon object a new PolygonOptions by calling this method:
setOptions(options:PolygonOptions).
You can see the different options here: http://code.google.com/apis/maps/documentation/javascript/reference.html#PolygonOptions
In this PolygonOptions you can then specify the color you want the Polygon to be filled with along with all the other stuff you could want to change.
You can also set the click to zoom in. That can be done using
map.setCenter(Polygon.getPosition()); //Polygon is Polygon to center on
map.setZoom(map.getZoom() + 1);

How to use bbox in long/lat with google/bing/etc… using mapserver‏

The bbox of OpenLayers.Control.GetFeature works in utm when the baselayer is 900913 ie. google/bing/etc) and in long/lat when the baselayer is 4326 (ie. my postgis layers served by mapserver), no matter what overlays them. This is what openlayers says.
So, how can I force bbox to be in long/lat when I use one of my layers over google for example? I do want the bbox being in long/lat rather than 900913 (ie. using baselayer projection). I've read many webs about this but with geoserver, some posts about mapserver say that both EPSG:900913 and EPSG:4326 must be set in METADATA, I changed that and also assigned "srs" and "projection" (with the appropriate expression) in my layers (and in protocols) but with no effect in bbox at all. What else could I try?
Any idea will be appreciated, thanks in advance,
Gery
To solve this problem is necessary to use prototype with OpenLayers.Control.GetFeature and then use .transform with epsg4326 and epsg900913, a bit more info about here: OpenLayers.Class with OpenLayers.Control.GetFeature

Horseshoe shaped polygon

I have the following kml polygon:
<Polygon><outerBoundaryIs><LinearRing><coordinates>20.002,80.002 20,80.002 20,80.004 20.006,80.004 20.006,80.001 20.002,80.001 20.002,80.002 20.004,80.002 20.004,80.003 20.002,80.003 </coordinates></LinearRing></outerBoundaryIs></Polygon>
If I view this polygon in a cell in my fusion table, in the Table View of Google Fusion Maps, it looks like this:
However, in the actual google map, in the Map View, it looks like this:
The duplicate point has been rather annoyingly dropped. I want what's shown in the first diagram above, but how should I change my polygon to get the same shape in google maps?
I also tried with an inner bound, but no luck there either:
<Polygon><outerBoundaryIs><LinearRing><coordinates>20.002,80.002 20,80.002 20,80.004 20.006,80.004 20.006,80.001 20.002,80.001 20.002,80.002 20.004,80.002 20.004,80.003 20.002,80.003 </coordinates></LinearRing></outerBoundaryIs></Polygon>
Thanks,
Barry
Self-intersecting polygons require quite a bit of extra power to draw correctly, so they are not widely supported in all 2d rendering APIs / implementations.
I suggest you work around the problem by splitting your polygon into two pieces.
Ok, I think I have the answer. I can add a tiny offset (jitter) to one of the two duplicate points in the polygon. However I must add the jitter in the correct direction otherwise the polygon becomes invalid and google no longer draws it. Looking at the previous points in the polygon loop, I should be able to establish in which direction I need to apply the jitter in.
<Polygon><outerBoundaryIs><LinearRing><coordinates>20.002,80.002 20,80.002 20,80.004 20.006,80.004 20.006,80.001 20.002,80.001 20.002000001,80.002 20.004,80.002 20.004,80.003 20.002,80.003 </coordinates></LinearRing></outerBoundaryIs></Polygon>

Adding an obstacle in Google map API

I have a polygon of a particular area,( this is an obstacle). When i give the start point and end piont it should not pass this polygon and should give a new route.
Any idea apart from adding waypoints of that particular polygon ?
Thanks.

How to utilise google maps to replicate functionality similar to rightmoves' draw-a-search?

I know this will be a complex solution. I would appreciate it if you could push me in the right direction.
Please have a look at http://www.rightmove.co.uk/draw-a-search.html. I am interested in finding out how this is possible. what steps do I have to take to achieve this?
There's quite a few things going on here.
You need to have event listeners for when the user clicks on the map.
You need to place markers where they click.
You need to draw two types of polylines; the static type connecting two markers, and the dynamic dotted line as they move the cursor or drag a marker.
When you've closed up the polygon, you need to make your search only return properties inside that shape (although they're actually doing it within X miles radius from that shape).
They're also inserting markers half-way along the lines that you can drag - this will require the geographical library, using the interpolate function.