Find Longitude Latitude in Large File - export

I would like to know if there is a quick way of doing this.
I have a data file with over 700,000 rows. The data file gives me the attributes Country, City, and Address. I need to use this data set on a Map report. My problem is the tool needs Longitude and Latitude attributes.
My file doesn't have Longitude or Latitude. Is there a way for me to get the Longitude and Latitude for the entire data set using the current attributes without having to look up the addresses one by one on google?

Related

Problem placing attribute in dimensional layout

I am doing a small exercise, I need to create a small dimensional design that deals with the tsunamis that have occurred in different countries over the years. I have created a "Country" dimension and a "Location" dimension. In each record of the provided table comes (or may not come) the longitude and latitude in which the place is located. My question is where should I put such attributes, whether in the fact table or in the location dimension. My understanding is that in the fact table it should only contain metrics and the foreign keys of the dimensions. However, I don't know how correct it can be to add the longitude and latitude to the location dimension, since by having the values a very wide range, many records are being created in the "Location" dimensional table. Would it be more appropriate to put those attributes in the fact table?
Thanks.
You should merge Location and Country into a single Location dimension (country is an attribute of location) and hold lat and long in the dimension
On the fact table. This is exactly like a fact that has a time attribute, with sub-second resolution. It's not necessary to create a dimension table containing every possible point in time, or every possible lat/long.

Searching for pages from a database that include a column with latitude and longitude

FOR EXAMPLE: I have event database that has multiple events, each event has different latitude and longitude, if my current latitude is 30.7263962 and longitude is 76.7664144, how I can fetch events from the database those are under 20 km range from my location?
Such a search would also be possible through ListView/CollecstionView?
Thank you very much

Address Table Scheme for Geolocation services

I have a SQL database with tables such as Stores, Users, etc.
Both Store and User, as well as other entities, have an Address.
I am considering creating an Addresses table for all Addresses:
Users
--------
UserId (PK)
AddressId (FK)
Name
Addresses
--------
AddressID (PK)
CountryID (FK) -> I have a table Countries with all Countries
Street
PostalCode
Locality
Region
Latitude
Longitude
When a user is filling the Profile I would have an input to type the address.
I would like to use Google Geocoding API to convert the typed address into its fields and save it into the database including Latitude and Longitude.
https://developers.google.com/maps/documentation/geocoding/start
https://developers.google.com/maps/documentation/javascript/geocoding
I have a few questions:
Is my Address table scheme appropriate for this?
I am planing to use Google Geocoding API so should I store the PlaceId then Google returns on my database?
My main objectives are:
Convert the address typed by the user into address fields and save to database;
By having the Latitude and Longitude of the address type by the user in my database I will be able to search them by location.
Example: Get users of my application in a radius of 20 km of a London address.
Did you thought about to separate the HouseNumber? Some external Services or API's require this. Its easier to concat this fields if required.
There is a geography Datatype for geolocations: https://learn.microsoft.com/en-us/sql/t-sql/spatial-geography/spatial-types-geography?view=sql-server-2017
With this type you can query the Database performantly with some geo functions e.g. distance between two points.
I wont save the Google-API result directly. Use your own required schema.
If you use the geography type you can query with Long/Lat and Distance by radius.

Using the SQL Server Geography data type

I am working with a SQL Server database that has a customer table in it that contains (among other things) an address column. This column houses the full address (street, city, state, zip) as one long text string. We are looking to convert this information into latitude & longitude coordinates for plotting on a map. I've been looking into using the Geography data type in SQL Server, but I cannot find any definitive information regarding what data actually needs to be entered into the Geography column in the database table.
The question I have: is there a way to use the Geography data type to convert the address string (or any part of it, City, Zip, etc.) into latitude & longitude coordinates?
For what you're looking to do, you'd need latitude and longitude information. The data type doesn't convert addresses inherently, but there are many services that you can use to do that.

Database Structure for Geocoding

I want to try and do a geocoding application and access data stored in a SQLite database. A postcode, town or city will be supplied, and I want to return the long/lat. I want it to be screaming fast but I'm unsure about how to organise the data in the DB.
Here is the data im working with:
Town, City, Postcode, Country, Longitude, Latitude
This may be simple but im new to this, I would benefit from some advice.
People will mis-spell all of the things that you propose using as your search criteria. So, do not use strings for Town, City, Postcode, and Country in this database table.
A good first step would be to use an Id, with the Id looked up in a separate table (e.g. the Towns table). A user could then lookup Latitude and Longitude using a combination of Id's. If one or more Ids are omitted, multiple results could be returned. For example, if they only supply the Id for the Postcode and Country, that will match multiple Cities/Towns.
A more efficient method of looking up specifically Latitude and Longitude would be to assign a specific place Id to each entry in the table that holds your Latitude and Longitude
PlaceId Latitude Longitude
Allow the user to lookup the PlaceId separately (by using a combination of Town, City, Postcode, Country and pick from among multiple return values to get a specific Place). Use that PlaceId to lookup Latitude and Longitude.

Resources