Extracting quarry sites geographic data from OSM or Google Maps API - google-maps

Does anyone know where or how I can get geographic data for quarry sites for Australian states or local governments? I have searched all over the data repositories hosted by the levels of government.
Now I resorted to extract this data from Openstreetmaps or Google maps API, but I can figure out how to achieve this after trying to check around. All the pointers doesn't seem to yield any data.
How can I get data and specifically quarry sites from OSM or Google Maps API?

Quarries are tagged in OSM as landuse=quarry. For retrieving specific data you can use Overpass API. Overpass API has a nice frontend called overpass turbo.
Here is an example query for retrieving all quarries in Australia:
[out:json][timeout:90];
// fetch area “Australia” to search in
{{geocodeArea:Australia}}->.searchArea;
// gather results
(
// query part for: “landuse=quarry”
node["landuse"="quarry"](area.searchArea);
way["landuse"="quarry"](area.searchArea);
relation["landuse"="quarry"](area.searchArea);
);
// print results
out body;
>;
out skel qt;
You can view the result here. There are also options for downloading raw data.
Constructing the query is as simple as opening overpass turbo, opening the wizard and typing "landuse=quarry" in Australia. Afterwards the timeout parameter has to be raised manually since the default timeout of 25 (seconds) is too low for querying such a huge country.
Note that the query language of Overpass API is quite powerful and there are many ways to enhance your query. Also note that it is possible to call Overpass API directly without the need of overpass turbo which is just a nice frontend.

Related

How to track multiple vehicles with Maps API

I'm working on new application in my workplace as described below:
We have tens trucks working for us. I've installed a GPS module on each of them to track their position and store their coordinates in a database.
I need to see their movements in real time on a map (Google Maps, or Bing Maps) but I don't know how to do this.
I don't want code or snippets, I prefer Guidelines and API Docs or framework to build it!
If you have any question ask without problem! Thanks guys
Since you have the data in a database, the first step would be to expose that data to your app. There are a couple of different ways to do this depending on the type of app you want to create, however the most universal solution would be to create a web service that any of your apps can connect to. Here are a couple of good blog post on how to create spatial web services.
http://blogs.bing.com/maps/2013/07/31/how-to-create-a-spatial-web-service-that-connects-a-database-to-bing-maps-using-ef5
http://blogs.bing.com/maps/2013/08/05/advance-spatial-queries-using-entity-framework-5
Once you have a web service you can then create the app that will display the truck locations. You have a lot of options here; web, mobile, desktop (WPF, Windows app), cross platform. Web apps tend to be the most common as they can be accessed from the most locations. Connecting to a REST service from JavaScript is fairly easy. There is a number of different ways to load in real time data. The easiest is to use a timer that calls your web service regularly and grabs all truck locations. A slightly more complex option, but more efficient is to timestamp the last update of each location and then keep track of the last timestamp used to request an update. By doing this you can limit your request to only retrieve updates that have occurred since the last request. This would significantly reduce your bandwidth and make your app faster. Displaying the actual truck location on a map is easy. Your web service will return the location information, likely as either two number properties (i.e. latitude/longitude) or as a well known text string (simply parse this as shown in the previous blog posts). If using Bing Maps and you have two number properties, you can create a pushpin and add it to the map like this:
var loc = new Microsoft.Maps.Location(latitude,longitude);
var pin = new Microsoft.Maps.Pushpin(loc);
map.entities.push(loc);
Here are some useful resources around developing with Bing Maps:
https://www.bingmapsportal.com/ISDK/AjaxV7
https://msdn.microsoft.com/en-us/library/dd877180.aspx
Note, if you use Bing or Google maps (or just about any other major mapping platform), they require all asset tracking applications to have a license to use the maps. If you use Bing Maps, you can find details on licensing here: https://www.microsoft.com/maps/licensing/licensing.aspx#mainTab4

How to feed location data from Twitter's streaming API into google maps

I'm building a twitter app on node and socket.io that should display the locations of streaming twitter data on a google map in real time. I'm having trouble figuring out the best way to grab the location from the Twitter Streaming API. The API has a coordinates attribute, but only 1-2% of all tweets have this data available, which kind of defeats the point of what I'm doing. There's also a location attribute for each user, which seems more promising. Given that user input/format is unpredictable, my current solution is to manually create a hash of US states/major cities with coordinates (in geo json- to feed to google maps) and reg ex to match with the user's location strings. Does anybody know of a better way to do this?
You can create a filter for the Streaming API which will only show you Tweets which have location information.
I assume, from your question, that you're only interested in messages from within the continental USA?
In which case, add the following parameter to your streaming request
locations=24.431150,-123.574219,47.683144,-59.238281
That's roughly the bounding box - you can adjust as you see fit.

Import Data From Google API to Parse

I am trying to import all restaurant data (within a certain location) from Google Places API to a Parse class. What is the best approach?
The types of data I need are: name, opening_hours (array), price, geometry (location), etc.
Do I need to download all the Google Places data first and then import it into Parse or can this be done all at once?
Parse supports "REST" API, should I be using REST or import through json/csv?
How do I go about "retrieving" the Google data? (trying to wrap my head around the concept)
Google API -https://developers.google.com/places/documentation/details
Parse Import API -https://www.parse.com/docs/data#data-import
Parse REST API -https://parse.com/docs/rest
Sorry for the newbie questions. I've never migrated data using API before.
I would advise against storing the data in a Parse class. The Google Places API is there for the ever-changing data that is out there on restaurants. If you import it into Parse, you would have to constantly update it. The Google Places API is fantastic and easy to use. Currently I use it in my AngularJS application for an autocomplete text input. I also use the Google Geocoding API in my Cloud Code with a Parse.Cloud.HttpRequest. Both work great but I would never want to import the API data and make it static...
I think a better option is like #jsetting32 commented about. Query the API for the events in the area, then save the one the user selects in a ParseObject. You can pick and choose the data you want to save and even give it start and end dates so users can look at past events.

Google or Bing maps API - creating and using your own map

What I need is the following.
Whenever I add any instance of object in my website, I need the server to add the location of the object to my own map either in Google maps or Bing maps (Bing maps docs are more clear therefore I'm going to use Bing).
Later, whenever I view the object in my site, the map should point to the location of the object and other my map objects in the same map.
How can this be achieved? Do I need to hold all the coordinates and object descriptions in my server, or somehow it is saved in the google or bing.
I went through the docs, but couldn't find any information I need.
You need to store them on your server and load them into the map on your webpage. There are ways with both google (fusion tables) and bing (spatial data services) of storing them with the provider but if you are already storing a copy for your website you are better off keeping them there for the map rather than maintaining two copies.
I'm not sure how technical you are but this best architecture approach is this:
1) Write a database query that finds objects to show on your map, ideally filtered by whatever the user can use to filter objects elsewhere on your site. Add to this query a filter by geographical bounding box (the range of latitude and longitude that can be seen on your map at any one point). The bounding box filter is just a simple sql BETWEEN clause but will mean you dont have to load every single object on to the map.
2) write a "webservice" that uses the database query in 1) and turns the results into JSON. This approach will lead to a much cleaner seperation between your mapping code in javascript and your server side code in the webservice.
3) Write your mapping frontend in Bing using javascript and use something like Jquery to read data from the webservice as the map is moved around re-load data that know should be shown on the new map view. As the data will be in JSON its much easier as JSON will just give you javascript versions of your objects

What states does my route travel through?

I've got a page that has a map with a starting and ending location. I run a route between them to get the nifty line showing the route. I'm currently using Bing but have attempted with Google as well. I'd like to know which states this route passes through so I can then overlay those states with specific information.
Any suggestions on how to obtain this would be most appreciated.
I'm using the AJAX SDK's for both Bing and Google. Handling all the local stuff with js/jquery.
You can use a reverse geo-code request on the Google Maps API to determine what state a particular point is in. So I imagine you could process your array of points returned with the directions request and pull out the state for each one.
In the v2 API, this would be:
results.AddressDetails.AdministrativeArea.AdministrativeAreaName
I think this is a bit more intuitive in v3. You can examine the AddressComponents array in the results to find the appropriate type:
{
"long_name":"California",
"short_name":"CA",
"types":["administrative_area_level_1","political"]
}
You could optimize the reverse geocoding by using divide and conquer on the array of positions on the route (if the state is the same for the first and middle position, then don't do reverse geocoding on the intervening points).
The MapQuest Directions web service has a stateBoundaryDisplay flag that will explicitly put state boundary crossings (ie "Crossing into statename") in the narrative. You could easily pull just that info from the json/xml response with a text search of the narrative steps.
http://www.mapquestapi.com/directions/#advancedoptions
Hope that helps.
Roman
You could create your own service utilizing a shapefile and a library like SharpMap or a geodatabase like mysql spatial, sql server spatial, etc. Then you simply just need to run an intersection query to discover which states your route runs through. This approach would work for any polygon set, so you could easily extend the solution to counties, voting district, school districts, etc.