Creating a $5USD a Month Geo-Location Service to Build Your Global Hustles

wadusay

Rising Star
BGOL Investor
Creating a $5USD a Month Geo-Location Service to Build Your Global Hustles

gis.jpg


In order to build next generation global business models using technology, brothas and sistas should first learn how to build the basic framework services. Once we focus on frameworks, then we can create real business models on top of them and make real moves. One of the technology blocks brothas and sistas will need for their hustle is location-aware functions. This article is going to show cats how to create a location-based web service they can reuse for all of their hustles to quickly build a variety of next generation applications.


Potential of Geo-Location Services

For August 2012, we will be launching an invisible pop-up store campaign for the hoods across the USA in honor of Dr. Martin Luther King Jr. unfinished fight for economic empowerment in our communities, among our people. I wrote several articles on exactly how we plan to implement the technology and we still have several ways to do it. However, the core technology will know where the user is located and then we can create offers from the location community based on their location.

Also, I had written an article discussing opportunities at airport hubs as the new economic opportunity. I noticed only one sista was smart enough to realize the opportunity. Let me explain something to the rest of these cats our there just in case they are too stupid to understand airports. The Atlanta Hartsfield-Jackson airport sees more upscale, high-income, educated Black customers ready to shop and buy in any given month than your whole damn city will see in a year. The use of mobile smart phones, 4G wireless speeds, idle travelers with extra money on them to spend – cats better get their head out of their butts and jump on it before someone else do.

With airport hubs, we can figure out what airport the user is currently at and use that location to offer them localized services. Cats who are doing layover flights, you can market their ass to shop locally while they sit there idle and that’s the opportunity you missing. This is why you need to make sure you have geo-location services at your disposal to create these types of services.

There are plenty of more services you can probably think of such as a proximately application that shows Black folks the nearest Black hair salon and you charge hair salons for the referral service. So all of the potential is there creating location aware stuff but there is one slight problem. The problem is and what I discovered there is no real web services out there that does exactly the type of stuff we need to do.

What needs to be done is we need to store all of our pre-defined locations such as all of the hoods or airport hubs in the USA and eventually worldwide. Then we need to capture the location of the mobile user and then we have to find if the user is actually near one of our spots. If they are near our spot, then we can offer the mobile user deals.

The Location Database

I spoke over and over that brothas and sistas are going to have to learn how to use databases. If you guys are not going to learn how to use data, then you will not make it as you will be subject to data manipulation for the rest of your lives. You got to learn databases, I don’t care what you do for a living or think about technology – this is a requirement in the 21st century.

I created the database already for you in SQL Server 2008 and you should be able to run these scripts I will provide to setup your database for to create the locations. You can download SQL Server Express 2008 from Microsoft Web Site and as I stated, I’m using a GoDaddy $5/month Windows hosting account and is works nice and highly scalable.




I do not have a version for MySQL because it does not the kind of geospatial functionality as SQL Server. And like I said, $5USD/month for a reusable web service should not have too many complainers when you are ground-floor hustling. So once you got SQL Server 2008 setup, run the Management Console and create a new database called “GeoSpatial” which you should learn by looking at instructions.




Now, in SQL Management Console, press the “New Query” button and in the new screen that shows up, this is the following script you want to run to create the table to store locations.


/****** Object: Table [dbo].[Locations] Script Date: 05/08/2012 21:27:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Locations](
[id] [uniqueidentifier] NULL,
[location_name] [nvarchar](500) NULL,
[location_description] [nvarchar](500) NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[geolocation] [geography] NULL
) ON [PRIMARY]
GO
/****** Object: Default [DF_Location_id] Script Date: 05/08/2012 21:27:04 ******/
ALTER TABLE [dbo].[Locations] ADD CONSTRAINT [DF_Location_id] DEFAULT (newsequentialid()) FOR [id]
GO


This table script creates a database table that allow you to store locations that you are going to cover. Let’s talk about each column:

Id – this is a unique field that is called a primary key. This will be used when we add more tables to reference this table. For example, in the invisible pop-up store project, we will create a table called city and street intersections for people without smartphones to simply type in their city and streets or select on that links back to this table by the id field.

Location_name. This is the name of the location and you can name it everything from J’s Salon to Madison and Pulaski in Chicago to ATL airport and this is just the name you are going to create for your location.

Location_description. This is just a description so you can know the location or an extra column to display when you show the user their location and description.

Latitude and Longitude. These are “float” values that use decimal values such as 48.858454 and 2.294694 which is the respectively latitude and longitude of the Eiffel Tower in Paris, France.

Geolocation. Do not worry about this field, I created a procedure to populate this once you add latitude and longitude.

So what you do is you insert the location name, the location description and the latitude and longitude of your locations by using Google Maps or Bing Maps which have a feature that display this data. This is how you gather your locations. In addition, many airports would have their own GPS on web sites because aircrafts use these coordinates to navigate.

Now the next script has to be run and is very important because these are your functions. Once you run these scripts you basically setup a $5/month geo-location database that will be the basis of all of your next generation hustles.

USE [GeoSpatial]
GO
/****** Object: StoredProcedure [dbo].[geolocation_get_distance] Script Date: 05/08/2012 22:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[geolocation_get_distance]
@latitude1 float,
@longitude1 float,
@latitude2 float,
@longitude2 float
as
declare @geolocation1 geography = geography::Point(@latitude1,@longitude1,4326),
@geolocation2 geography = geography::Point(@latitude2,@longitude2,4326)
select @geolocation1.STDistance(@geolocation2)
GO
/****** Object: StoredProcedure [dbo].[geolocation_refresh_geography] Script Date: 05/08/2012 22:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[geolocation_refresh_geography]as
update locations
SET geolocation = geography::STPointFromText('POINT(' + CAST([Longitude] AS VARCHAR(20)) + ' ' + CAST([Latitude] AS VARCHAR(20)) + ')', 4326)
where geolocation is nullGO
/****** Object: StoredProcedure [dbo].[geolocation_get_nearest] Script Date: 05/08/2012 22:02:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[geolocation_get_nearest]
@latitude float,
@longitude float
as
declare @userlocation geography = geography::Point(@latitude,@longitude,4326)
select location_name,location_description,latitude,longitude
from locations
where locations.geolocation.STDistance(@userlocation) <=1000
order by locations.geolocation.STDistance(@userlocation)GO

The script above has some very powerful functions so let’s go over each one and how to use them. And yeah, I wrote these scripts and this is probably the same code I will be personally using to drive the invisible pop-up store for the hood project.

geolocation_refresh_geography. This stored procedure is what you run once you enter the latitude and longitude and it will convert into a geography data for the geolocation field. We will be using the geolocation field to perform geo-location calculation. So run this after you

geolocation_get_distance. This is just a calculation to get the distance between two points. This is be used for showing how far someone is from a location and if they are getting closer, that is the plan I have for it.

geolocation_get_nearest. This is the real geo-location service I need out of all of them. This is the service that takes the user current latitude and longitude and do a search to find the nearest location listed in our database. I also filtered their location to a certain distance so it only display something if they are in reasonable range. This is the code that helps us determine if the mobile user is in the hood or at the airport that we have listed in our database.

Summary

This is just part one because I know this is a lot of data. We will talk about how to get the location from the user in a follow-up article. So once you able to create this database table, the next step is to create a web service where you can send a REST message and receive the geo-location information back in XML format. You can use the same $5/month web site hosting account to create the web site that returns the XML message.

As you see, this is the kind of stuff brothas and sistas should try to establish as their basic blocks to their framework to creating next generation hustles. Once you learn how to build these kind of basic blocks then you will be able to build real stuff that will take you places.


http://dreamandhustle.com/2012/05/creating-a-5usd-a-month-geo-location-service-to-build-your-global-hustles/
 
In order to build next generation global business models using technology, brothas and sistas should first learn how to build the basic framework services. Once we focus on frameworks, then we can create real business models on top of them and make real moves.

how do we do that? not being funny @ all.. I dnt know!:smh::confused::(
 
ok im listening, .... i will have some info to add here later my thing is I learn best by building.... I would love to try to get a MVP up..
 
Back
Top