Problem in Shapefiles - maps

i need a help
i have a shape file that continue 3716 polygon record and want to draw this shape file where some of those polygons need to have a specified color
OR WANT a search technique to search this map for a point (lat-long) and get it's belong polygon but not by searching all polygons
i tries all, OpenJump-Source code, GeoTools,....

In GeoTools you can follow the Style tutorial to show you how to display your shapefile. There is no way to carry out a point in polygon search without at least examining the bounding box of each polygon but the GeoTools Query Lab will talk you through the basics of setting up a query (and if your shapefile has a spatial index then it will be quick enough).

Related

Is it possible to drag-snap a point of a shape being edited by the drawing manager to another shape's point location?

I'd like a user to be able to draw a polygon using the Azure Maps Drawing Manager and have the ability to move a point of the polygon to near one of another polygon's points and have the dragged point snap to the same location such that the resulting 2 points would be the same.
I know there is snap capability with a grid but don't see a sample for this behaviour?
The ultimate goal is to prevent polygon overlaps, assuming the intersecting shared line of adjoining shapes is excluded from determination of which polygon a point resides within.
I can allow a user to manually draw and get as close as possible of course, and provide some assertion to confirm no polygons overlap but would additionally like a nice snap-to-point experience if possible.
You can find hundreds of samples for Azure Maps here: https://samples.azuremaps.com/
As you noted, the snapping grid is likely the best place to start in your scenario. Here are some specific samples of this:
https://samples.azuremaps.com/?sample=use-a-snapping-grid
https://samples.azuremaps.com/?sample=snap-grid-options
The following sample is an example of a custom snapping scenario where the routing service is used to snap a drawn line to a route (the route part can be swapped out for custom logic): https://samples.azuremaps.com/?sample=snap-drawn-line-to-roads

How to store useful information about a polygon drawn by google maps drawing tool and then again draw it by that information?

I am trying to draw a polygon with maps drawing tool. Now I want to store useful information about that polygon in the database so I can again draw that same polygon by retrieving the data.
what is that information and how I can use that to draw same polygon?
I would suggest you use a Data type of Varchar/ Specific data type (depending of Database in use) in the table and store the metadata of Polygon or any shape as XML/JSON.
Here's link a https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingResults

Leaflet.js - How can I draw a polygon that automatically covers a group of markers?

I´m working with Leaflet.js and I have a lot of markers but I want to get a polygon drawn automatically containing a specific group of markers.
There´s an image:
Every marker has a specific radio, so if a use it, would be like this:
but I don't want that, I want an area that contains markers, I don't know how can I do that.
You might want to create a convex hull.
https://gis.stackexchange.com/questions/215137/how-to-create-a-convex-hull-with-leaflet-points:
"The easiest way to do this with javascript is to use Turf.js's convex functionality."
A working sample - http://bl.ocks.org/ebrelsford/c31f61d39d2cd559e18a

Bounding Box Search in JDO and GAE

i have my current lat,lon
and i want to make Bounding Box Search in GAE data store to get every nearest location to my current point .
i want the bounding box to be 1 km around my point
how can i do this ??
Check this example: http://code.google.com/appengine/articles/geosearch.html
It is in Python, but the discussion of the associated problems and ways to implement precomputed boxes could be helpful to you.

In PostGIS a polygon bigger than half the world is treated as it's opposite

I'm using GeoDjango with PostGIS and trying to use a polygon to get records from a database which fall inside it.
If I define a polygon which is bigger than half the area of the earth it assumes the 'inside' of my polygon is the smaller area which I intended as the 'outside' and returns only results which are outside it.
I can just use this smaller, wrong area to exclude results. Polygon.area seems to know what I intend so I can use this to determine when to make my search inclusive or exclusive. I feel like this problem is probably common, is there a better way to solve it?
Update: If 180 degrees longitude is inside my polygon this doesn't work at all. It seems GEOS is to blame this time. This image shows what I believe is the reason. Green is the polygon I define, Red is how it seems to be interpreting it. Again this seems like a problem which would crop up often and one that libraries like GEOS are made to deal with. Is there a way?
Alright, no answers. Here's what I've done.
Because GEOS doesn't like things crossing the 180th meridian:
First check if the polygon crosses the 180th meridian - If so, break it into 2 polygons along that line.
Because PostGIS assumes a polygon is as small as possible you can't make one cover more than half the world, so:
Check if the polygon or each of the split polygons covers half the world or more - If so, break them in half.
Construct a MultiPolygon from the results.

Resources