Geocoding: call longitude latitude from mysql table - mysql

I'm not very good at programming and just a beginner. My English is not that good, so I hope you can understand my question.
I'm interested to make a map like this but with a few modification: https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple
I have a mysql table with 3 columns: unit, lat, lng.
I want to make a map where user input the unit name, then it will look up for the value in mysql table, take the longitude latitude value, and display the address in google maps marker tooltips.
How do I do that? Thank you before!

You want to do this you need to learn webservices then only you can access you table.
Use this for restful webservice
using geocoder you can find the address corresponding lat and lag
use this website

Related

Find closest airport (Lat,Lng) using provided Latitude Longitude in PHP

I am working to get the latitude and longitude of nearest POI like airports, schools around a secondary latitude and longitude. So far i have searched and found the following API
http://maps.googleapis.com/maps/api/geocode/json?address=airport,Nashik&sensor=false
Unfortunately it works with the address instead of the secondary latitude and longitude. and if I insert the latitude and longitude it gives me the address of that point.
Is there a way to find the nearest airport(latitude,longitude) from the provided (latitude,longitude). I am trying this in PHP.
Please take a look at Google Places API
It's not that it fully meets your requirements and it has its limitations ("the maximum allowed radius is 50,000 meters", "radius must not be included" if you specify rankby = distance), but you can give it a try anyway.
Your requests could look like this
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.712784,-74.005941&rankby=distance&type=airport&key=<Your API Key>
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.712784,-74.005941&radius=50000&type=airport&key=<Your API Key>
You can use Aeris Weather api. Here's the documentation https://www.aerisweather.com/support/docs/api/reference/endpoints/places-airports/
You'd want to use closest action with largeairport filter to avoid smaller/non commercial/military airports
ex: https://api.aerisapi.com/places/airports/closest/p={lat,lng}&limit=5&radius=50miles&filter=largeairport&client_id={ID}&client_secret={SECRET}
You can query using other place params too https://www.aerisweather.com/support/docs/api/reference/places/
A PHP package for the api https://packagist.org/packages/mariohbrino/aeris
They have 6 months free trial and then its $23/month for basic plan.

Leaflet markercluster: How can I change the bounds of the markercluster?

For university I create a webmap using leaflet - it´s about migration in Iraq. In the map I have one choropleth-layer with coordinates from a json (Iraq with its gouvernorates) with a value for each gouvernorate. Additionally I added a layer with markers from another json to the map. This json only contains the coordinates for markers with a value for each marker. I implemented a leaflet markerclustering where all child markers are summarized and the sum is shown in the parent-icon - although the sum isn´t correct until now, I think it is working, so far... I am allready looking for the mathematical error...
Now, I would like to change the bounds for the marker-clustering (currently I think they are built automatically and randomly by leaflet) to the bounds of the gouvernorates in the first json of Iraq. The aim is a regionbound clustering for the gouvernorates of Iraq. There are some examples on the web and I have tried a lot, but it doesn´t work...
maybe somebody here can help me.. If you have any questions or need further explanation, just tell me!
Sources:
- json code in an js-file "iraq_09_14.js" with the gouvernorate-polygon-coordinates of Iraq
json code in an js-file "target-location_09_14.js" with marker-polygones and value for each marker
this is the js-code where I create the leaflet map
this is the js-code where I create the markerclusters with the sum of the values
I would like to change the bounds for the marker-clustering [...] to the bounds of the gouvernorates in the first json of Iraq.
Then create one instance of MarkerClusterGroup per governorate, and add each marker to the corresponding cluster group.
This json only contains the coordinates for markers with a value for each marker.
You should really pre-process the data, so each marker has information about what governorate it belongs to. You might want to do point-in-polygon geoprocessing, via Turf or otherwise.
(currently I think [the clusters] are built automatically and randomly by leaflet)
They are not random, the hierarchical greedy clustering algorithm is deterministic. You can read more at https://www.mapbox.com/blog/supercluster/

Get latitude and longitude of address in Asp.net?

How can I get a latitude and longitude of some location in asp.net MVC4?
For example how can I get the latitude and longitude of Hafeez center, Lahore, Punjab, Pakistan?
You can use the google GeoCoding service to convert an address to a set of coordinates.
For example for your address you would call:
http://maps.googleapis.com/maps/api/geocode/xml?address=Hafeez+center,Lahore,Punjab,Pakistan&sensor=false
My recommendation would be to do something like:
var responseDocument = XDocument.Load("http://maps.googleapis.com/maps/api/geocode/xml?address=Hafeez+center,Lahore,Punjab,Pakistan&sensor=false");
Then read the xml to the information you need.
Edited to add - make sure you check google's terms and conditions, they prohibit some types of applications!

how to check the google map api to know the place is existing one

I have use the code given below, please copy and paste in your URL, which gives latitude and longitude of a specific place.
But when I have used the same call with wrong place it returns latitude and longitude. How to check whether it is right and wrong?
http://maps.google.com/maps/api/geocode/json?address=dubai+United+Arab+Emirates&sensor=false
http://maps.google.com/maps/api/geocode/json?address=anu+India&sensor=false
Thanks
A typical scenario for using geocoding will be when you know that the address exists and you want to get the location coordinates, maybe to mark on a map. When you search an address in google geocoding api, it will find exact matches and also partial matches to correct for cases like spelling mistakes or multiple spellings in use. Due to partial match, when you search for a word, words close to that in terms of the letters used and the number of letters present will also be found. You can explore 2 options to refine the results:
1, If you want to avoid partial matches , you can try component filtering , where you specify filters on components like locality, country , etc and only exact matches will be returned.
2, You can process the json result in your code by retreiving different components and doing comparisons and taking only cases matching your requirement.

Cross Street Coordinates

I want the latitude and longitude of two street that cross from the Google Geocoding API.
It should be a simple matter to determine the syntax, but I am unable to find any examples.
I can, however, offer and example that doesn't work:
http://maps.google.com/maps/api/geocode/json?address=maple+street+and+main+street,+Anywhere,+MO&sensor=false
The "and" keyword is wrong. Is there a proper syntax, or should I just kill myself?
I think you've got the right syntax. Your example doesn't work because there is no Anywhere, MO so the service is returning the only thing it recognized, which was the state of MO.
The API correctly returns locations of type intersection for the queries like:
http://maps.google.com/maps/api/geocode/json?address=Main%20Street%20and%201st%20Street,%20Springfield,%20MO&sensor=false
and
http://maps.google.com/maps/api/geocode/json?address=Amphitheatre%20Parkway+and+Charleston%20Road,+Mountain%20View,%20CA&sensor=false