how to select markers in the polygon from mysql - javascript

i'm saving markers coordinates in mysql like below image
what i need is when user draw on maps like below image
i could get the shape and select markers in the shape from mysql and create a query.
for example:
$query= mysql_query("SELECT location FROM table WHERE Coordinates in the polygon");
i belive i need use ajax. and i'm using google maps v3
is this even possible to do that ?
PLEASE HELP, Any idea that i could somthing like that other way ??

Google maps does not provide GIS functions to select the coordinates inside a polygon. You could do using the spatial extension ( data type GEOMETRY) for mysql .. and for this you can go into that ..http://dev.mysql.com/doc/refman/5.7/en/spatial-extensions.html for mysql doc.
A simple way to select locations (points) in google maps is to use the extreme values of the coordinates of the polygon points to get the equivalent to the coordinates of the rectangle that contains the polygon vertices and then perform a select
select location
from my_table
where location_lat >= minLat_polygon
AND location_lat <= maxLat_poligon
AND location_lng <= maxLng_polygon
AND location_lng >= minLng_polygon

Related

Map values to a custom map (warehouse)

I have a database with values with locations points.
I want to "draw" a custom map - a warehouse in this case rectagular with rows and columns and walls - and i want to map and color those positions with my values saved.
My question, is there any tool that can help me do this?
thank you

Google map multiple markers mapped to an area without coordinates

I have a very strange requirement from my client and I am not sure if it is achievable.
Here's the requirement:
The client wants to display a Map zoomed to a country level having 4 filters:
1. Drop down based state filter which should populate the cities in the city filter and the map should zoom to state level
2. Drop down based city filter which should populate the area filter and the map should zoom to city level
3. Drop down based area filter which would zoom the map to the area level.
This is where it gets tricky:
Once the map is zoomed at area level, it should display all the markers in that area and none of the markers have coordinates or address. They are only attributed to that area boundaries and are randomly/evenly spread out in that area so that all the markers are visible.
A marker clustering should be fine here but I don't know how the markers themselves can be placed in that area without coordinates or addresses, just based on area boundary coordinates.
Now comes the fourth filter:
4. A search box filter which will search the data only within those area markers and whichever matches, is shown and the rest are hidden
I believe I can still take care of the 4th filter, but it's the 3rd filter which is driving me crazy.
Is there any mechanism by which we can place multiple markers (with no coordinates or address, only associated to an area boundary), inside a highlighted area boundary and randomly/evenly distributed within that area so that all the markers are visible?
Thanks in advance.
One way of solving this comes to mind is using the getCenter from LatLngBounds class from google maps. This does require getting the polygon coordinates from somewhere else.
let coords = [{lat: -34, lng: 151},{lat: -34.5, lng: 151.5},etc]
let bounds = new google.maps.LatLngBounds();
coords.forEach(LatLng => bounds.extend(LatLng));
let center = bounds.getCenter(); //returns LatLng variable
This can also be used to center your google maps on an area with the function fitBounds:
map.fitBounds(bounds);
Using this would solve 2 of your challanges, the zoom and center

How to get area coordinate in google map api

I have a address and i need to area coordinate(longitude and latitude) of that place in Google (recommended) or any map in JavaScript or PHP
I need list of longitude and latitude of above 4 corner using Google map API.
Google map link
One option would be to right click on the map, choose "What's here", take the coordinates from the box that appears
Doing that for your property, that gives me:
-33.801421, 151.133470
-33.801580, 151.133691
-33.801364, 151.133919
-33.801328, 151.133804
http://jsfiddle.net/geocodezip/otr0p64h/

How to highlight region in google map by location name

I am new in google map i want to highlight region when user enter place name like "Delhi","Mumbai" and it should be highlight with red boundary. google provides same feature like this. I did google but i did not get any responsive answer.so can anyone tell me that how can i highlight region.
Thanks
First you need the coordinates of the polygons of the regions that you want to highlight, then you can create for each of these new polygon that has the attributes stroke_ fill_ * and * that you need

AngularJS - plotting points on a map

I am new to AngularJS and I am looking to add some plotting functionality to my web app.
I have a map of the world (a png file) and X/Y coordinates that I want to overlay on top of the map image. For example, my data might look like:
[
{
'location_x':'123',
'location_y':'224',
'date':'20100505',
'text':'I loved this place!'
},
{
'location_x':'222',
'location_y':'333',
'date':'20110606',
'text':'Never again!'
}
]
I would like the date values to appear in the area designated by the x/y coordinates, and the text to appear as a tooltip for the date.
I do not need the application to expose the capability to edit the x/y coordinates, I only need to display the values that my data source gives me. I need to use a custom image as the map. What are my options for getting this done?
You could use LeafletJS .
Another option is to use the Google Static Maps API.

Categories

Resources