Geographical location in google maps - sql-server

I'm working on project that deals with advertisements and google maps. I save every advertisement latitude and longitude in my database, but I want to add an option that show user on the map and show all available advertisement around it with radius of 1 km, but I don't know how, Can anyone help me?

Seems to be an interesting project. These are the steps I suggest you :
Store you latitude/longitude as a geography data type using SQL Server. See geography (Transact-SQL).
From your webpage, retrieve the user location. See Use Geolocation API with Angular.js.
Send back the position to your web api (create a new action into your controller).
Write a stored procedure that take the user position as parameter and return the advertisement around it with radius of 1 km. See SQL Geometry find all points in a radius (Geography and Geometry have quiet the same functionalities).
Send the Advertisement location to the client side and use Google Map to show it (I am sure you're going to find some good tuto about that).
Good luck !

Related

User location in database

first of all I would like to clarify that I am not very professional in laravel or angular. I am trying to make a simple application in which I keep user ads. And I have no idea how to implement geolocation. With geolocation I mean the location of the user. I do not know if it would be better to save only the coordinates or the address in the database. What I'm looking for with this is when I show the ads of the users, I also get what part of the world they come from. And also be able to do searches from the location (Ads closer to the user or distant)
Thanks in advance.
You could store coordinates for the user. That's pretty much all you would need to do. All maps API's have a radius search feature that allows you to search within X miles or kilometers of a given coordinate. After you have your user's coordinates and know the coordinates of where your ads are relevant, you can then do a query to determine if the user is within the ad's reach.
If you want to simplify things a bit and not have to make a ton of API calls each time a page is loaded, you could simply assign a region to each user when they store their address. And then for each ad, you would assign the regions where you would like to show the ad. For example, if a
user is in region=USA and the ad is relevant for region=[USA,Canada,Mexico], then the user would see the ad. I don't know how granular you need to get, but this would most likely be the simplest implementation of what you're trying to do.

Microsoft Cognitive Services Face API - Get uploaded images

I played around with the MS Face API and wonder if there is a possibility to get the uploaded images back? For all uploaded images I get a faceId which can be added to persons and persons to groups and so on. But I have not found a way how to display e.g. the persons which are member in a group.
Or is the concept to save all images on the client and add the received id to the image on the client? Than is the question what happens with the images which are uploaded for face detection?
regards,
Jochen
The API doesn't allow the images to be retrieved back. You're right about the general use case, the IDs help you reference the correct image(s) in the application. Often times you'll want to upload a smaller image to the API than what you want to display to the user.
You can always submit feature requests to the team's public backlog over at: https://cognitive.uservoice.com/

Developing an app that sends a picture to a web page using couchbase

ok guys, im pretty confused with a class project i've been assigned. I need to make an app that allows the user to take a picture, and then send it to a database. I also need to create a webpage where all the pictures taken with the app will be shown. so, the user takes the picture with the app, and then it sends it to the page, where its displayed. I guess is something like a pseudo-instagram.
the part that really confuses me is the database/server part of the app. i think the app will send the pictures to the database, from where the website will retrieve the latest ones (or some other sorted way). after reading a little about databases i found couchbase and i think thats the way to go.
The part i dont really understand about couchbase is where is the data stored. does couchbase just gives me the database and i have to store all the information (photos) somewhere like a computer that acts as a server or in the cloud; or its stored in some kind of server provided by couchbase?
also, is what i described the way to go in this app? the basic idea is to send information from the app to a database/server and then retrieve that data to the webpage. any advice is truly appreciated. Thank you in advance.
couchbase provides key value store. Data is stored within the couchbase. In your case you need to store the images as value. CouchBase is capable of storing binary data. So, you probably want to convert your images in the binary data and store it.
CouchBase has great API, which you can query to retrive your images.
Not sure if this helps you. good luck with your project.

Storing Bing maps data in SQL Server, creating a route from saved location

I want to store locations in the form of longitude & latitude in SQL Server. I'd then want to retrieve and display it on Bing Maps. The goal would be to show route to them from the user's current location.
I think there is a location service which is different from Bing Maps, and maybe it would be provide me with what I need.
How can all of this be done?
Here is a pretty good article that shows how you can visualize routes in a Windows Phone application. As of SQL CE storage, you might want to start here.
You can have a look on WP7 Code Samples:
http://msdn.microsoft.com/en-us/library/ff431744(v=vs.92).aspx
Local Database Sample
Location Service Sample
Also try this: http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners/GPS-Location-API-and-Calling-Web-Services

Geocoding out of Salesforce.com (large number of static adresses)

We have developed an application in Salesforce.com to geocode and display account information (address information) on Google Maps within Salesforce.com. We have around 750k addresses for the initial (one-time) geocoding process (static address data), as we store the lat/lon with the account.
Is their any way to get this geocoded done in one 'batch' as we seem to hit the daily allowance of request per day (3k)?
Thanks for your support and feedback.
If you'd like to use Google to do this and you need to precompute the lat/lon coordinates, you'll need to upgrade to the Google Maps API for Business. The table on that link provides a detailed overview of the limit differences, and I suspect that the terms of use may also be more in line with what you're developing too.
If your goal is to create a Google Map from the addresses, you may also consider just passing the address data instead of the latitude and longitude. Their static maps will work fine as long as you know which locations that you'd like to use on the map, you don't have too many locations in one map and you don't need interactivity. Otherwise, you should use the javascript API and their documentation is very good for that.
If you don't know which locations you'd like to use on the map, you could use the lat/lon coordinates of their zip codes (which are freely available) to create a view port.
If you'd like a static map of the locations (whether or not you precompute the lat/lon), I'd recommend taking a look at the apexgooglestaticmap Github repository. It makes it quite easy to make certain types of static Google maps in APEX and VisualForce. Here's an example from that README:
APEX Controller
String[] homes = new String[]{'Albany, NY','Wellesley, MA','New York, NY','Pittsburgh, PA','01945','Ann Arbor, MI','Chicago, IL'};
GoogleStaticMap.MapPath moves = new GoogleStaticMap.MapPath(homes).color('0x000000ff');
String movesUrl = new GoogleStaticMap().addPath(moves).url;
Visualforce Page
<apex:image value="{!movesUrl}">
Google Maps URL and Image
https://maps.google.com/maps/api/staticmap?sensor=false&size=500x350&markers=label:0%7CAlbany%2C+NY&markers=label:1%7CWellesley%2C+MA&markers=label:2%7CNew+York%2C+NY&markers=label:3%7CPittsburgh%2C+PA&markers=label:4%7C01945&markers=label:5%7CAnn+Arbor%2C+MI&markers=label:6%7CChicago%2C+IL&markers=label:0%7CAlbany%2C+NY&markers=label:1%7CWellesley%2C+MA&markers=label:2%7CNew+York%2C+NY&markers=label:3%7CPittsburgh%2C+PA&markers=label:4%7C01945&markers=label:5%7CAnn+Arbor%2C+MI&markers=label:6%7CChicago%2C+IL&path=weight:5%7Ccolor:0x000000ff%7CAlbany%2C+NY%7CWellesley%2C+MA%7CNew+York%2C+NY%7CPittsburgh%2C+PA%7C01945%7CAnn+Arbor%2C+MI%7CChicago%2C+IL&
There are also many other geocoding APIs available. They each have their own terms of service, so make sure that your application matches the acceptable uses before you build anything with them. I've personally used PCMiler Web Services with success, and Geonames for reverse geocoding (they have a number of other great features too).
Google only allows that max per IP Address. If you were able to maximize the locations you were doing them from, max out at work, home or maybe your local starbucks, you could be able to hit the goal easily. If you have more than 250 employees just assign the 'homework' of going home and geocoding it! Spread the wealth, and the fun, of geocoding!
The other solution is using Google Maps API For Business, which allows you to do a max of 100,000 requests per day. For more information look at: http://code.google.com/apis/maps/documentation/geocoding/ ; for more information specifically on Geoogle Maps API For Business: http://code.google.com/apis/maps/documentation/business/index.html
I use this geocoder, and add my list and use yahoo to get the lat and long.
We have FindNearby installed, so once I get all the addresses geo-coded, I add them back into my excel worksheet in the respective column that has the Record ID. Since we use FindNearby, I have to add a column that is titled Mapping Status, and all cells under this say Located. I used ApexData loader to mass upload into SF. Note, geocoder has a limit of only 1000 records at a single "code" click, but it has no limit of how many lists you can process per day.
I changes some code to use Bing map services instead of google. There limits are based on keys and are much larger. Also when the key hits its max requests, then you can just get a new free key and apply it.

Resources