Google Fusion Table - Proximity Search - proximity

I might have gotten in over my head here, and am looking for any possible assistance, as I am really not familiar with writing code. If you can dumb down any possible answers, that'd be spectacular.
I created a Google Fusion Table that lists worldwide sea ports by city and country, and visualizes them on a map. I want to have the ability to type in an inland location and have the map mark the location, and advise the closest one or two seaports.
For example: I enter a location of Richmond, VA, and the map will mark Richmond, VA on the map, and advise that the Norfolk, VA and New York, NY sea ports would be closest.
I'm not sure where to begin to accomplish this. Is this too vague of a question? Any help provided will be greatly appreciated!

You can accomplish this using a bit of JavaScript code. The Fusion Tables Layer in the Google Maps API allows you to find the nearest n neighbors to a latitude, longitude coordinate. An example can be found here:
https://developers.google.com/fusiontables/docs/samples/nn_example
Here are the overall steps you would take to create the app:
Create an HTML page that has a search box plus a map with the Fusion Table Layer displaying the data from your table
When the user enters a search term, such as Richmond VA, you would geocode the string to get the lat/lon coordinate. You can use the Google Maps API geocoding service:
http://code.google.com/apis/maps/documentation/javascript/geocoding.html
When you get the lat/lon coordinate, use this to update the query sent to the Fusion Tables Layer (similar to the example above) to show the 2 nearest ports.

Related

Query geospatial data with BigQuery

Hi I would like to obtain a list of public locations (restaurant, hotels, cinema etc.) neighbours based on GPS coordinates. Is this possible with BigQuery ?
If you have lat-lon or GPS coordinates as columns, you could definitely grab rectangular regions from BigQuery using WHERE comparisons on the coordinates and then aggregate on the selected rows.
The scalar operations available in BigQuery are pretty powerful too -- you can add a variety of arithmetic functions to your query and still get excellent performance.
You find listed example queries on the linked page:
Return a collection of points within a rectangular bounding box centered around San Francisco (37.46, -122.50).
Return a collection of up to 100 points within an approximated circle determined by the using the Spherical Law of Cosines, centered around Denver Colorado (39.73, -104.98).
GCP announced new geospatial data types and functions with BigQuery GIS.New functions and data types follow the SQL/MM Spatial standard and will be familiar to PostGIS users and anyone already doing geospatial analysis in SQL.
Also, a new lightweight visualization tool called BigQuery Geo Viz is announced which is designed for BigQuery users that want to plot and style their geospatial query results on a map.
Implementation, currently in alpha. You can request to get access.
More details can be found here - GCP Blog

Creating a Choropleth Map at the County Level

I'm trying to create an animation of the population density of the Appalachian region from roughly 1790 to 2010 in decennial steps at the county level.
I've successfully created a choropleth for 2010 by modifying what was done in this tutorial by Nathan Yau. I've run into a few problems. For one, US county boundaries evolve rapidly over time so I can't use the same SVG file as in the tutorial. I think I need to do the following:
Obtain historical county boundaries as GIS files from here.
Convert GIS files into SVG files using Kartograph (after installing its numerous dependencies).
Obtain population data (with FIPS info) for each county in Appalachian region since 1790 from US census data.
Mimic what was done in tutorial to create choropleth for each decade and stitch together into animation.
This just seems insanely complicated for something so simple and I'm new to a lot of this so I'm not convinced I'll be able to get all of it to work. I guess my questions are the following:
Will the strategy I outlined work? Is there a better/simpler way to do what I'm trying to do?
Also, as for getting the census data, this also seems harder than it has to be. I just want a simple .csv file with say FIPS label, county name, and population for a given year, and yet the best I can find is something like this with a link to the actual source in some arcane format.
Thanks for any help!
You can download tables of population data by county from the US Census here:
http://factfinder2.census.gov/faces/tableservices/jsf/pages/productview.xhtml?src=bkmk

Determine if GPS location is within city limits?

I want to be able to determine if a GPS location is in an inhabited or uninhabited zone.
I have tried several reverse geocoding API like Nominatim, but failed to get good results. It always returns the nearest possible address, even when I selected a location in the middle of a forest.
Is there any way to determine this with reasonable accuracy? Are there any databases or web services for this ?
If you have to calculate that youself, then the interesting things start:
The information whether or not a region is inhabited is stored in digital maps in layer "Land_Use". There are values for Forest, Water, Industry, Cemetary, etc.
You would have to import these Land_use polygons into a special DB (PostGres).
Such a spatial DB provides fast geo indizeds for searching only the relevant polygons.
Some countries may also fit in main memory, but then you need some kind of geo spatial index, like Quad-Tree or k-d tree to store the polygons.
Once you have imported the polygons, it is a simple "point in polygon" query, or "polygons within radius r". The typoe of th epolygon denotes the land use.
OpenStreetMap provides these polygons for free.
Otherwise you have to buy them from TomTom or probably NavTeq (Nokia Maps). But this makes only sense for major companies.
Since you're using Nominatim, you're getting the coordinates of the nearest address back in the reply.
Since the distance between two coordinates can be calculated, you can just use that to calculate the distance to the closest address found, and from that figure out if you're close to populated areas or not.

Google Maps Shading of Australian Suburbs

I need a way to shade Australian suburbs in different colours based on my input.
Not sure of how to do this with Google Maps API.
Google maps has Australian suburbs boundaries and I want to tell Google Maps to shade each Suburb a different colour based on my instruction. I am very very open to how to do this.
My goal is to have a Google Map that is interactive that has suburbs shaded different colours. You can zoom out and look across a region and see if there are suburbs in common or with different colours. The key would be based on things like Median house price, house sale volumes, demographics etc.
Why: There are 3 reasons to do this.
To place a screenshot in a powerpoint report
Send a link to a client and show them their area with different information encoded
Built a system in the future that pulls this from a DB and generates this as part of a web portal
How: I have a spreadsheet with information like: Cherrybrook, Red, Castle Hill, Blue, Kellyville, Pink (or HTML colours, or numbers - whatever the format required can be generated).
If possible I also want to label the suburbs based on the colour that they become (this may be a Google Earth feature).
You might be able to use the Polygon class, but there are performance limits on how many polygons you can show at once. If you only show one metro area at a time, you might be okay.
More likely, you will want to create tiles. See
https://developers.google.com/maps/documentation/javascript/overlays
for documentation on tiles.
This is very powerful. You can see, for example, a web site I and a friend made which shows Australian 2006 census data by census tract by using tiles at:
http://sunburntpeople.com/census/

Roads Shapefile Names

I have a shapefile with a road network and it seems like the roads are all listed as 1 big polyline. Is this typical is it possible to get a road network where the roads are listed individually and have names associated with them?
thanks,
Jeff
If someone sent me a shapefile of roads where all the roads were a single polyline, I would assume the person was playing a practical joke on me.
Typically, a useful shapefile of roads would at least be broken into a single line for each defined road, or even better, a network intersection-to-intersection segment shapes.
It's not a trivial task to split up a single polyline into a more useful multi-segmented shapefile.
Doing a quick Google search returns a couple of free solutions for shapefile editors although I can't vouch for any of them. I use my company's own codebase written in C# using Tatuk for working with shapefiles.
http://www.nrdb.co.uk/nrdbview/
http://www.forestpal.com/blog/?p=21