How do i pull sql data and pass to google maps API - javascript

please be kind, I'm new to coding. Can I ask that you explain things as simply as you can for me. I have an sql table that contains building information inc. Longitude and latitude(over 5 thousand buildings). I need to pull this data into visual studio and then pass it to my Google maps api to drop markers according to the lat and long. There are tutorials using php but we don't use php. I really need and appreciate any help you can give me. I have created a json file from sql and copied it into a json file in VS. So the bones are there, I just need help putting it together.
Thank you
Mike.

Create a stored procedure. which takes buildingId as an input parameter. and select the latitude and longitude in SP. you can pass these values to the API

You can also check this thread. Maybe it would help you with jQuery and Javascript.
Retrieving latitude and longitude from mysql, passing it to google maps api

Related

Search within a Google map area outline (neighbourhood)

this community has been really helpful so far!
Does anyone know if there is a possibility of getting the region outline from Google Maps and getting an array of elements within that area? For example, if I type "Brooklyn", I would like to get an array of the properties advertised in my website. I can't find documentation on the API docs...
Thanks,
Eric
This is not possible in mysql.
You need to store that data in some graph database like neo4j. Mysql is not meant to store such points / graph data. You can only store tabular data in mysql.

How can I get the name of the closest gas station printed out using Google Places API for javascript?

I'm pretty new to Javascript, but I want to create a simple app. It must show the name of the closest gas station when a button is clicked. It also must print it using document.write().
I have been looking at the documentation that Google has provided and I am confused about how to use rankBy.DISTANCE routine.
Any help would be appreciated. Thanks!
Get the longitude and latitude of your location through javascript. According to it check whether is there any gas station available within your preferred area. You can get the javascript api from Link is here
To use rank by closest distance see this

Get latitude and longitude from address with leaflet

In my project I am using leaflet.
I am getting addresses from my database (in array with php) and want to show latitude and longitude associated to each address.
I know there is a great geocoder developed for Leaflet:
https://github.com/smeijer/L.GeoSearch,
but I don't konw how to use it for my purpose.
Can anyone help me on this?
Any help would be gratly appreciated.
I would advise on using http://open.mapquestapi.com/nominatim/
There you will have an example of how to create a query and you will see the look of the response you will get. The are basic simple search examples and the look of the code that runs it. Inside of the response you will have the lat/lon pair so you can use that to draw the marker on your map in Leaflet.js

Get the elevation from a point without viewing Google Maps

I have readed the API for elevation for Google Maps and what I can understands I must have the map visible to get the elevation for a point (coordinates). But almost nothing is impossible with JavaScript so I wonder now, is it possible to get the elevation from a point without viewing the map?
Thanks in advance.
Do you know what the co-ordinates are for the point? If so, the API for elevation will return the elevation, in both JSON and XML formats. I use the following URL (albeit in PHP, it should work the same for Javascript):
http://maps.googleapis.com/maps/api/elevation/xml?sensor=false&locations=1.111,1.111.
You'll need to parse the results in JS. Switch XML out for JSON in the URL to change the result type.
Edit: If you use this service, you need to use it in conjunction with a Google Map as per their terms and conditions.

Google Maps API - point of interests

I am working now on little project.
In one view i am returning data for google maps API (longitudes and latitudes).
Under the map I have to implement few buttons to add point of interests on the map in this location which is actually showed.
There could be some buttons/types of POI like schools, banks, atms etc.
So, let's go back. When I put all my markers on map how to add there points of interests?
I would like to get below data for them:
longitude (needed for show)
latitude
type
title
description
I know, that there is google local ajax search api, but I am not sure if it is correct way to do.
I know how to find this data using google maps interface, for example:
Example Map
http://maps.google.pl/maps?f=q&source=s_q&hl=pl&geocode=&q=category:%22Banks+%26+Financial+Institutions%22&sll=51.510202,-0.12144&sspn=0.01859,0.05549&ie=UTF8&cd=1&ei=N4hUS7ynEc7AjAeWtNm4CA&radius=1.19&rq=1&ev=zi&hq=category:%22Banks+%26+Financial+Institutions%22&hnear=&z=15
but how to do this using API?
Thanks.
The Google Local Search API can be used to obtain a small number of such points at a time, as in this example. Or you could just add the Googlebar to your Maps AVI v2 map.
Access to large numbers of such points at once is not available from Google, and is generally not available for free.
In addition to Google, there are other data providers you can use. For example, the API at http://compass.webservius.com allows you to retrieve data on more than 16 million businesses in the US (including name, lat/long, business type / industry code, etc).
The Google API is a Javascript API.
If I understand you correctly, you want to add markers on a Google Map using the Google Maps API.
The documentation suggests that either you hardcode your Markers or create one by creating a Marker Manager.
I have never used Google Maps API but if you want more info, visit the documentation here.
Good luck!

Categories

Resources