Kivy MapView offline - android-mapview

I'm planning to write a Kivy app containing a (small) offline map. Kivy's Mapview widget seems to be a good choice to display maps but before I start diving into it further one question that I couldn't figure out: Is it possible to use Mapview offline, by using locally stored tiles?

I managed to do it, it turns out it is not that complicated to do but it took some research (at least for a beginner like me). Here is a rough outline:
1. MapView supports mbtiles as source as detailed in the documentation - mbtiles can be created in TileMill
2. I wanted a map in Openstreetmap style, so I downloaded openstreetmap-carto from github. The installation manual explains quite well what needs to be done in order to obtain a map in this style
4. There the biggest challenge was to set up and manipulate a PostGIS database. This link helped: http://www.bostongis.com/PrinterFriendly.aspx?content_name=loading_osm_postgis
There were some additional issues along the way but all could be solved by combing through the internet.

Related

How can I replicate GitHub's app code block style in UITextView?

I am trying to create a markdown editor for fun and because I was interested in learning TextKit. I am working on iOS devices only, so I only have UIKit framework at my disposal, also I watched this WWDC18 video which explains some best practices to adopt with TextKit. At first I was really interested in knowing how to get the same result that the video shows at 22:13.
The code shown by the dev in the video makes use of AppKit and it wraps code in that rectangle by replacing the code section with a NSMutableParagraphStyle and by providing a custom NSTextBlock to the latter. As you can guess, I can't subclass NSTextBlock in UIKit and therefore I can't replicate the example shown.
I have something a little bit harder to ask though, what I really wanted to replicate is the GitHub application code block style, this is the final result that I would like to replicate:
As you can see it should have a rounded rectangle with a custom background color and also it needs to be scrollable in order to make code expand as much as it needs (I am not interested in syntax highlighting).
How can I achieve something like this if NSTextBlock is not available in UIKit?
For the moment all I have done is override NSTextStorage to set the correct font to the code section with custom NSAttributedString.
I have investigated in the app and noticed that it is managed by Ryan Nystrom which is the creator of GitHawk prior to moving to GitHub. The GitHawk markdown reader is very similar to the one that you find in the GitHub application and the funny thing is that GitHawk is open source so I took a look at that code and tried to understand how that could be replicated.
Turns out that GitHawk heavily uses IGListKit framework and parses markdown in ListDiffable elements, specifically the code blocks ListDiffables are given to a ListSectionController that created an horizontal UIScrollView to display code.
I gave up trying to understand more on this because GitHawk code is really really entangled and it is really hard, near impossible, to extract the specific functionality.

Is it possible to show a satellite map on Windows 10 UA app

I'm trying to make my first Windows 10 UA desktop app. I have a working map, but it shows the road type of map. The problem with this is, the detail isn't there, and may people won't be able to get enough info out of this.
Is there a way I can switch the map view from a road to a satellite map?
Edited for response
Sorry I miss understood, didn't realize you where using the MapControl class. Below is a link that explains how to use 3d aerial and street views (towards the bottom)
https://msdn.microsoft.com/en-us/library/windows/apps/mt219695.aspx
the code you are looking for is something like
MapControl1.Style = MapStyle.Aerial3DWithRoads;
Absolutely! You can use the Bing maps API. http://www.microsoft.com/maps/choose-your-bing-maps-API.aspx
Here is a link to a guide on getting started.
https://msdn.microsoft.com/en-us/library/ff428643.aspx
From the API you can then select the satellite map instead of the road.

Which tools to build a complete interactive mapping application/web application?

I want too build a web application, and I am looking at the tools I will have to use.
I want to use a real time map
I'm a thinking about :
Tilemill to get .png in order to constitue the background of my maps
or get data from a webite in shp files to build layers for this in mapnik.
Mapnik Build layers with the data I want to add on my map.
Mapnik : Put layers together and generate a map.
TileStache : generate tiles for my application.
Openlayers : Display my map with tiles in a browser.
Once my map is displayed, I'd like to add interactivity. For example when you go over a line or a circle (a town/ an event), then it gives you the attributes of this object.
But the lines and circles will integrated dirctly to the mapnik map, so I need to add some javascript to make it dynamic and open a pop-up. How do I do this ? Using Openlayer javascript libraries or node.js.
What is your advice on the question/the way I want to use theese tools?
Thanks a lot!
I'm in a similar situation, so I don't know the answer, but from what I've been able to figure out I think you're on the right track.
I started off using the Mapbox approach, which simplifies things as long as your data is static. You use Tilemill not only to generate your PNG tiles (once you've used Carto to do some nice styling) but also to import your data sets.
TileMill can export your TileJSON and UTFGrid files with the PNG tiles all packaged up and ready to use. Mapbox will then host all that stuff for you, and you can use their mapbox.js library (an extension of Leaflet) to bring it all together in the browser, with full interactivity. Opening popups would be something you'd do in Javascript in the browser - and if you mean infoWindows (the overlay window that's associated with a map point) then that would be a call to the Leaflet API.
If you're happy to create your layers and import your data offline this approach seems to be really simple and powerful; Mapbox will even render out tiles using multiple layers overlaid - so for example you can see your circles on top of a satellite image, merged into a single PNG.
The problem really comes in when your data needs to be live and you can't therefore prepare it all ahead of time in TileMill. I'm still trying to figure this all out but it does seem as though a combination of TileStache and Mapnik would be able to serve you up the TileJSON, GeoJSON and UTFGrid files you'd need as well as the tiles themselves, in the way you've outlined in the question.
You might also want PostGIS and GeoDjango or similar behind the scenes in order to hold and manage your live data, respectively.
As I said, I'm still trying to actually get my full stack working so I can't vouch for this 100% but if your data is gathered upfront then I'd definitely recommend the TileMill route for simplicity's sake.
I hope that's a help!

What can I do to make my sub-derived custom control appear in the Blend Assets library?

I am creating a series of window mockup templates based on the excellent Mockups library available on CodePlex.
I'm using their BaseMockup as the base for my control as well, and I followed the same outline of the steps listed here for sub-deriving from existing controls (Create a new empty class, add your default style to /Themes/generic.xaml, etc.)
The control is working great - the only thing is that it doesn't show up in the Assets library. I think this is because it's sub-derived, or because I need some attribute (the equivalent of the ToolboxItemAttribute for WinForms controls? ... which didn't work) to get it hooked up.
When I modify the code to derive directly from Control, it shows up - no custom attribute necessary. Of course that defeats the purpose of what I'm trying to do though...
The only thing I can find are several articles telling me to muck with registry keys, and none of them are clear or suggest a definitive way to do this with Blend 4. That last one advertises as a Blend 4 tips article, but admits at the end that it plagiarizes the content from the other two (for Blend 3).
Is that my only option - register my DLL? Is there a better way to do this?
A while ago I wrote a blogpost about this. I've included a .reg file and a .bat file for setting up the register and some directories. I think that's what you are looking for.
I believe you do need to muck with registry keys. Specifically,
32 bit: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NET Framework\v4.0.30319\AssemblyFoldersEx
64 bit: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NET Framework\v4.0.30319\AssemblyFoldersEx
Create a new key with the name of your control assembly. Then edit the Default string value under this key and set the value to the directory where the control assemblies are installed. See here for a full example (using the Silverlight paths).
Found it - there is an analogue attribute after all, it's ToolboxBrowsableAttribute.
You have to go through a little more rigmarole to get it set up, but it works great - no registry mucking necessary. It requires creating a designer metadata provider class, attributing your assembly so it's designer-discoverable, and then adding the attributes to your sub-derived controls inside your metadata provider.
Make sure you choose the appropriate version of the page for your version of Visual Studio, because the interface changes a good bit between 2008 and 2010.
This article on CodeProject has some good, real-world examples of setting this up. They're all in the 2008 style though, so bear that in mind if you're using 2010.

Can I associate custom metadata with an ALAsset?

I'm building an iPhone app that, among other things, allows the user to take and store photographs associated with locations. I am currently using the ALAssetLibrary to allow the photographs to be stored in Photos and be accessible outside the app (on a computer for instance via the built-in mechanisms). There is not a lot of technical content out there for working with the ALAssetLibrary but from what there is I have managed to cobble together a working version of this. I have had to resort to storing a dictionary of photo URLS in my app and manually detecting if the photo still exists when displaying lists of them because there does not seem to be a way to add custom metadata to an ALAsset.
What I would really like to do is add two custom metadata fields to each asset to provide it with a title and a custom id value that I can use to filter on when enumerating the asset library.
As a secondary task, I'd like the user to be able to update the title metadata.
Can it be done? At this point, I really don't think it can because the API really doesn't seem to provide the necessary methods to get/set custom metadata. I'm hoping against all odds that there is some other aspect to the AssetLibrary framework that I have not yet discovered.
At a minimum, if someone can authoritatively say "NO" then at least others might find this breadcrumb on their own trail of hope and change tack more quickly!
And, having 0 reputation I can't tag it with AssetLibrary :( wow, this day is just going downhill. FML
I've been looking over the documentation and I dont think it is possible to tack on additional fields to the ALAsset object, well you can create your own object or extend theirs but that wont help you when your pulling back assets because you'll need to init yours and populate it then.
Look I know this falls short of a really good answer but I had to try.
The ALAsset class documentation describes a property - customMetadata. This is documented to be an NSDictionary of whatever custom tags you want. Currently, however, it is not implemented in the class (I've raised a bug on Apple's developer site to bring the issue up).

Resources