I have been creating a twitter bot to post satellite images of random coordinates and I have found that the vast majority are of the ocean, so I would like to somehow make the bot detect that the entire photo is blue and repeat the process. The bot code is available here.
Thanks in advance.
As an alternative to employing machine vision to assess the content of the image to determine whether to sample again, you could simply sample from coordinates that are not the ocean! There are many files produced by geographers that have sought to map the boundaries of the world's continents.
For example, see here for code to do so. You'll need to understand projections and other features of Geographic Information Systems if you want to get extremely accurate, but you can get reasonably accurate using the polygons for oceans. If you REALLY wanted to get accurate, you could obtain a set of shapefiles that partition all possible coordinates (rather than a single "world" shapefile) and use the more-detailed mapping that may accompany those more-zoomed-in shapefiles.
Alternatively, you can implement the model here, provided in a guide to water detection in satellite imagery using Python.
Related
The below linked map contains a number of layers which I would like to be able to extract as polygons [if possible]. I've not previously done any web-scraping and realise that doing so in regards to the geographic data on this system represents a significant challenge.
Ideally I would only want to extract the data relating to the 'Shopping Local Centre' category.
Happy to try to use Phython or R to achieve such, just wondered if anyone had any ideas.....
Web scraping (using BeautifulSoup, for example) would get you the HTML objects from a webpage. You would need basic knowledge of Python for this.
Or you could avoid that by going this route:
With QGIS and Geofabrik you can gather retail location polygons and their attributes of a given area.
Use Geofabrik to download your area of interest in *.shp (shapefile) format. It looks like you're in Greater Manchester, so I navigated to the download page here (it's a 50MB file for the greater-manchester-latest-free.shp.zip).
Once you download that, open it in QGIS and you'll see in the attributes it has retail locations.
That site is using WMS to display the map (I work for the company that makes iShare) so there is no vector content for you to scrape as it works entirely with images.
The easiest way to get the data would be to ask the council to provide it, you might need to make it a freedom of information request but they should be happy to provide the data in a usable GIS format.
I'm trying to visualize GPS points on PowerBI maps offline and wonder what would be the best way to achieve that.
Ideally, I'd like to see the offline mapping to have the same effect as directly using the "Map" visualization - GPS points (in data as longitude and latitude columns) plotted on the Bing map. However, our team will need this function offline, because our users are usually under bad internet connections. Also we are wary about Bing's data sharing policy as our GPS information is highly confidential.
So far I've tried PowerBI's shape map function, which allows me to upload a TopoJSON file and use it offline. However, it looks like shape map is better used for highlighting a region on the map, instead of plotting individual GPS points - shape map doesn't seem to allow longitude/latitude. Besides that, shape map does not have as much information like Bing map, such as showing city/road names and etc.
Is there a way to visualize GPS points offline on PowerBI, but still get enough information about what are around the GPS points? I'm referring to PowerBI here but all things I've been doing are on PowerBI Desktop. I don't plan to publish on the web as this will be my company's internal tool. Thanks in advance!
The built-in mapping functions such as the Map visual powered by the Bing maps API and the Eris mapping do not have an offline mode. Both require an online connection. Depending on the level of detail that you require, I would suggest looking into an R or Python visual with one of the mapping libraries. Here are some examples of the R mapping libraries. But getting the map json files into Power BI will also be an issue and may not meet your requirements on the level of detail that you need.
Also we are wary about Bing's data sharing policy as our GPS information is highly confidential.
I wouldn't worry about it, Bing & Power BI mapping is used by a wide number of organisation including heath and military customers. Your confidential data is more at risk with some one copying your Power BI report and sticking it on a USB drive.
However, our team will need this function offline, because our users are usually under bad internet connections
I would try some other options for offline mapping, for example Google Maps has the ability to down load a section of the map for offline/bad connections. I've downloaded the whole UK and its about 100meg.
Hope that helps
I need a polygon for every German state. I go all the GeoPoints in one JavaScript-file but the file is because of the amout of points about 4MB. I've been googling and thinking about this problem all day but couldn't figure out a solution...
How can I use Google Maps polygons without forcing the user to download a huge js-file with the coordinates?
Thanks!
Ron
You can encode the polygon points to vastly reduce the size of the javascript file. To do this, you must include the geometry library.
https://developers.google.com/maps/documentation/javascript/reference#encoding
https://developers.google.com/maps/documentation/javascript/geometry#Encoding
One option is to use a FusionTablesLayer to display the polygons. They are available in the Natural Earth data set that is publicly available.
Example
You could do the same with your points and a KmlLayer if you convert your data to KML.
Well... somehow the points have to get to the user. You could think of the following solutions to reduce the data usage:
Use different polygons for different zoom levels. For example zoomed out you won't need the full details.
only send parts of your polygon back to the user. You can for example send the viewport coordinates to an AJAX script. This one queries your database and/or shapefile and only returns the polygon parts that are visible in the user's viewport
preprocess tiles. If you can generate images from your shape, you can overlay these on Google Maps.
So what I'm trying to do is the following:
Have a map (such as Google Maps or questMaps). It doesn't matter at all which API I need to use.
On that map have an overlay on the streets. So say (for example) the street has bad lightning at night, it will be colored red. If it has good lightning it will have a green overlay.
Based on the overlay the map creates a custom route (for example the user only wants to walk on the green/well lit streets).
I have no idea how to accomplish this (especially step 3).
First, you'll have to decide what data you need. How do you categorize certain streets as lit or unlit? What if some parts of a street are well lit and some have no lights? Do you need to know the location of every streetlight in your area? What if lights burn out?
After figuring out what data you need, you need to build your dataset. I'd be VERY surprised if this data already exists, so you will probably need to gather it yourself. Either go around town and take notes, or crowdsource the project, or figure out some other way.
Once you have gathered your data, learn the drawing API of whatever mapping tool you wish to use. They all should have functions in their API for drawing colored lines (for streets) or points (for streetlights) on top of an existing map.
Finally, learn the navigational API of the mapping tool you chose. You're right, this is a hard step. I know Google Maps lets you specify certain waypoints when requesting directions; maybe your app can calculate well-lit waypoints and feed them to Google Maps' Directions service to influence the route it generates.
Good luck!
For custom routing, you need to read up on "Graph Theory". This ignores the geography of the street map, and considers it as a set of junctions (nodes or vertices in the graph theory jargon) connected by edges. You can assign weights to edges - these could be lengths, travel times, ones and zeroes etc. Anything. They can have no relation to the position on the map.
So for your application, you'd assign a large weight to unlit streets, and a small weight to lit streets, then use a standard minimum-weight algorithm to get a route from one node to another.
Is there any way to get the approximate length and width of a building, given its' address from an API such as google maps or similar? I basically want to use it to find the lat, long coordinates of the approximate boundaries of any building or area that the address is inputted for. Free APIs or services would be preferred.
I don't think so - that would require enormous efort to catalogize most of the map into "is a building/is not a building" (I'd guess the military might have that, but they're unlikely to share (if they even have it)). What you could do is this:
- geocode address to lat/long
- grab satellite image of the surroundings
- try to detect shape in that
- estimate physical size from zoom+pixel size
I see a few problems there:
not sure if GMaps allows image scraping
the building may not be distinguishable from the background
the address might be geocoded off a building, or betwen two buildings
the address might be shared amongst multiple buildings