{"id":17138044,"url":"https://github.com/moagrius/mapview","last_synced_at":"2025-04-13T09:52:18.689Z","repository":{"id":4787679,"uuid":"5940085","full_name":"moagrius/MapView","owner":"moagrius","description":"(Deprecated, prefer https://github.com/moagrius/TileView) Android widget roughly described as a hybrid between com.google.android.maps.MapView and iOS's CATiledLayer","archived":false,"fork":false,"pushed_at":"2013-08-06T02:58:32.000Z","size":21069,"stargazers_count":69,"open_issues_count":0,"forks_count":35,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-27T01:21:44.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://moagrius.github.com/MapView/documentation","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moagrius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-24T20:00:29.000Z","updated_at":"2023-06-22T20:18:47.000Z","dependencies_parsed_at":"2022-08-19T03:30:52.219Z","dependency_job_id":null,"html_url":"https://github.com/moagrius/MapView","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moagrius%2FMapView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moagrius%2FMapView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moagrius%2FMapView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moagrius%2FMapView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moagrius","download_url":"https://codeload.github.com/moagrius/MapView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248695302,"owners_count":21146952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T20:08:37.542Z","updated_at":"2025-04-13T09:52:18.668Z","avatar_url":"https://github.com/moagrius.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp\u003e\u003cstrong\u003eUpdate (August 5, 2013)\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThis widget has been superceded by \u003ca href=\"https://github.com/moagrius/TileView\"\u003eTileView\u003c/a\u003e.  All future commits will be to TileView.  MapView will be eventually discontinued entirely as TileView supercedes it.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUpdate (April 20, 2013):\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e\n    Updating to 1.0.2, fixing a couple bugs, adding support for custom Bitmap decoders, improved intersection calculation\n    (thanks to \u003ca target=\"_blank\" href=\"https://github.com/frankowskid\"\u003efrankowskid\u003c/a\u003e), and some standardization.  Also added\n    the source for a \u003ca target=\"_blank\" href=\"https://github.com/moagrius/MapViewDemo\"\u003esample app\u003c/a\u003e and \u003ca href=\"http://moagrius.github.io/MapView/MapViewDemo.apk\"\u003ea working .apk\u003c/a\u003e\n\u003c/p\u003e\n\u003cp\u003eChanges:\u003c/p\u003e\n\u003col\u003e\n  \u003cli\u003eFixed bug in pixel-based positioning created in 1.0.1\u003c/li\u003e\n  \u003cli\u003eMarker anchors are no longer \"flipped\" (if you want the marker to be offset by a negative value equal to half its width, use -0.5f... It used to be non-negative 0.5)\u003c/li\u003e\n  \u003cli\u003eAdded new method (and interface) `setTileDecoder`, which allows the user to provide an implementation of a class to decode Bitmaps in an arbitrary fashion (assets, resources, http, SVG, dynamically-drawn, etc)\u003c/li\u003e\n  \u003cli\u003eAdded concrete implementation of `MapEventListener` called `MapEventListenerImplementation`, that impelemts all signatures so you can just override the one's you're using\u003c/li\u003e\n  \u003cli\u003eUpdated \u003ca target=\"_blank\" href=\"http://moagrius.github.io/MapView/documentation/\"\u003edocumentation\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003cstrong\u003eUpdate (March 28, 2013):\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eUpdating to 1.0.1, fixing several bugs, reinstituting undocumented or previously removed features, and adding some experimental stuff.\u003c/p\u003e\n\n\u003cp\u003eFixes:\u003c/p\u003e\n\u003col\u003e\n  \u003cli\u003eFixed bug in draw path where start y position was incorrectly reading x position\u003c/li\u003e\n  \u003cli\u003eFixed bug in setZoom where it was maxing to the minimum (this method should work properly now)\u003c/li\u003e\n  \u003cli\u003eFixed bug in geolocation math where the relative scale of the current zoom level was not being considered\u003c/li\u003e\n  \u003cli\u003eFixed bug in all slideTo methods where postInvalidate was not being called\u003c/li\u003e\n  \u003cli\u003eFixed bug where a render request was not issued at the conclusion of a slideTo animation\u003c/li\u003e\n  \u003cli\u003eFixed signature of removeHotSpot\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eEnhancements:\u003c/p\u003e\n\u003col\u003e\n  \u003cli\u003eReinstated support for downsamples images.  See MapView.java for new signatures\u003c/li\u003e\n  \u003cli\u003eNo longer intercepts touch events by default.  This can be enabled with `setShouldIntercept(boolean)`\u003c/li\u003e\n  \u003cli\u003eNo longer caches tile images by default.  This can be enabled with `setCacheEnabled(boolean)`\u003c/li\u003e\n  \u003cli\u003eadded `clear` and `destroy` methods.  The former is appropriate for `onPause`, the latter for `onDestroy` (incl. orientation changes)\u003c/li\u003e\n  \u003cli\u003eadded `resetZoomLevels` to allow different sets to be used during runtime\u003c/li\u003e\n  \u003cli\u003eonFlingComplete now passes the x and y value of the final position\u003c/li\u003e\n  \u003cli\u003eadded onScrollComplete (fires when a slideTo method finishes)\u003c/li\u003e\n  \u003cli\u003eexposed lockZoom and unlockZoom methods.  These can be used to prevent a tile set from changing (useful during animated or user-event driven scale changes)\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003eKnown issues:\u003c/p\u003e\n\u003col\u003e\n  \u003cli\u003eThe positioning logic has gotten a little crummy.  It works but is a little bloated and distributed across more parties than it should.  I don't think experimental status fits, but it's close.\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\u003cem\u003eNote that the documentation has not been updated, nor has the jar - will get to those as soon as I get some time\u003c/em\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eUpdate (March 8, 2013):\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eWhile this component is still in beta, the version now available should behave predictably.\u003c/p\u003e\n\u003cp\u003e\n  This commit entails a complete rewrite to more closely adhere to Android framework conventions, especially as regards layout mechanics.\n  The changes were more significant than even a major version update would justify, and in practice this version should be considered an\n  entirely new component.  Since we're still debugging I'm not bothering to deprecate methods or even make any attempt at backwards compatability;\n  the previous version in it's entirely should be considered deprecated, and replaced with this release.\n\u003c/p\u003e\n\u003cp\u003e\n  The \u003ca href=\"http://moagrius.github.com/MapView/documentation\"\u003edocumentation\u003c/a\u003e has been updated as well.\n\u003c/p\u003e\n\n\u003cp\u003eAn quick-n-dirty, undated, unversioned and incomplete changelog:\u003c/p\u003e\n\n\u003col\u003e\n  \u003cli\u003e\n    The component no longer requires (or even supports) initialization.  Rendering is throttled through handlers and managed directly\n    via onLayout and event listeners.  This also means no more \"onReady\" anything - it just runs.  Just add some zoom levels and start using it.  In theory, zoom levels can be added dynamically later\n    (after the code block it was instantiated - e.g., through a user action), but this is untested.\n  \u003c/li\u003e\n  \u003cli\u003e\n    Zoom levels are now managed in a TreeSet, so are naturally unique and ordered by area (so they can now be added in any order, and you're no\n    longer required to add them smallest-to-largest)\n  \u003c/li\u003e\n  \u003cli\u003e\n    Image tiles now use caching, both in-memory (25% of total space available) and on-disk (up to 8MB).  For the on-disk cache, you'll now need to include\n    external-write permission: \u003cpre\u003e\u0026lt;uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" /\u0026gt;\u003c/pre\u003e.\n    Testing for permission is on the todo list - right now you'll just get a runtime failure.\n  \u003c/li\u003e\n  \u003cli\u003e\n    Now supports multiple listeners (addMapEventListener instead of setMapEventListener).  Note that the interface is now MapEventListener, not OnMapEventListener.\n    We now also provide access to a lot more events, including events for the rendering process and zoom events (where zoom indicates a change in zoom level, \n    in addition to the already existing events when the scale changed)\n  \u003c/li\u003e\n  \u003cli\u003e\n    We now intercept touch move events, so Markers won't prevent dragging.  The platform is still janky about consuming and bubbling events, but I think this is about as good as it's going to get.\n  \u003c/li\u003e\n  \u003cli\u003e\n    Removed support for downsamples.  That behavior wasn't visible in most other similar programs (e.g., google maps, CATiledLayer); it seemed to confuse some people; and it really hurt performance.\n    I may consider a single low-res image as a background (rather than a different downsample per zoom level), depending on user feedback.\n  \u003c/li\u003e\n  \u003cli\u003e\n    Removed support for tile transitions.  There was no way to keep this from eating up too much memory when abused (fast, repeated pinches between zoom levels), when we wanted to keep the previous\n    tile set visible until the new one was rendered.\n  \u003c/li\u003e\n  \u003cli\u003e\n    Added support for zoom-level specific Markers and Paths - you can now specify a zoom index to addMarker/Path calls, which will hide those Views on all other zoom levels.\n  \u003c/li\u003e\n  \u003cli\u003e\n    Drastic refactorization and optimization of the core classes.  \n  \u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e\n  If you test this on a device, please let me know the results - in the case of either success or failure.  I've personally run it on several devices running several different versions of the OS, but\n  would be very interested in results from the wild.  I'll be working on putting up a jar and a sample app.\n\u003c/p\u003e\n\n\u003cp\u003eFinally, thanks to everyone that's been in touch with comments and ideas on how to make this widget better.  I appreciate all the input\u003c/p\u003e\n\n\u003ch1\u003eMapView\u003c/h1\u003e\n\u003cp\u003eThe MapView widget is a subclass of ViewGroup that provides a mechanism to asynchronously display tile-based images,\n with additional functionality for 2D dragging, flinging, pinch or double-tap to zoom, adding overlaying Views (markers),\n multiple levels of detail, and support for faux-geolocation (by specifying top-left and bottom-right coordinates).\u003c/p\u003e\n \n \u003cp\u003eIt might be best described as a hybrid of com.google.android.maps.MapView and iOS's CATiledLayer, and is appropriate for a variety of uses\n but was intended for map-type applications, especially high-detail or custom implementations (e.g., inside a building).\u003c/p\u003e\n \n \u003cp\u003eA minimal implementation might look like this:\u003c/p\u003e\n  \n \u003cpre\u003eMapView mapView = new MapView(this);\nmapView.addZoomLevel(1440, 900, \"path/to/tiles/%col%-%row%.jpg\");\u003c/pre\u003e\n \n A more advanced implementation might look like this:\n \u003cpre\u003eMapView mapView = new MapView(this);\nmapView.registerGeolocator(42.379676, -71.094919, 42.346550, -71.040280);\nmapView.addZoomLevel(6180, 5072, \"tiles/boston-1000-%col%_%row%.jpg\", 512, 512);\nmapView.addZoomLevel(3090, 2536, \"tiles/boston-500-%col%_%row%.jpg\", 256, 256);\nmapView.addZoomLevel(1540, 1268, \"tiles/boston-250-%col%_%row%.jpg\", 256, 256);\nmapView.addZoomLevel(770, 634, \"tiles/boston-125-%col%_%row%.jpg\", 128, 128);\nmapView.addMarker(someView, 42.35848, -71.063736);\nmapView.addMarker(anotherView, 42.3665, -71.05224);\n\u003c/pre\u003e\n\n\u003ch4\u003eInstallation\u003c/h4\u003e\n\u003cp\u003e\n  The widget is straight java, so you can just use the .java files found here (with the dependencies mentioned below), or you can download\n  \u003ca href=\"http://moagrius.github.com/MapView/mapviewlib.jar\"\u003ethe jar\u003c/a\u003e.\n  Simple instructions are available \u003ca target=\"_blank\" href=\"http://moagrius.github.com/MapView/installation.html\"\u003ehere\u003c/a\u003e.\n\u003c/p\u003e\n\n\u003ch4\u003eExample\u003c/h4\u003e\n\u003cp\u003e\n  The source for a working app using the MapView is \u003ca target=\"_blank\" href=\"https://github.com/moagrius/MapViewDemo\"\u003ehere.\u003c/a\u003e\n  The compiled .apk for that demo is \u003ca href=\"http://moagrius.github.io/MapView/MapViewDemo.apk\"\u003ehere.\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch4\u003eDependencies\u003c/h4\u003e\n\u003cp\u003e\n  If you're targetting APIs less than 12, you'll need the \n  \u003ca target=\"_blank\" href=\"http://developer.android.com/tools/extras/support-library.html\"\u003eAndroid compatability lib\u003c/a\u003e\n  for the LruCache implementation.\n\u003c/p\u003e\n\u003cp\u003e\n  \u003ca target=\"_blank\" href=\"https://github.com/JakeWharton/DiskLruCache\"\u003eJake Wharton's DiskLruCache\u003c/a\u003e is also used.\n  \u003ca target=\"_blank\" href=\"https://oss.sonatype.org/content/repositories/releases/com/jakewharton/disklrucache/1.3.1/disklrucache-1.3.1.jar\"\u003eHere's\u003c/a\u003e a direct link to that jar.\n  However, that package is bundled with mapviewlib.jar so is only needed if you're using the java files directly in your project.\n\u003c/p\u003e\n\n\u003ch4\u003eMaven users\u003c/h4\u003e\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003ecom.github.moagrius\u003c/groupId\u003e\n\t\u003cartifactId\u003eMapView\u003c/artifactId\u003e\n\t\u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\u003ch4\u003eDocumentation\u003c/h4\u003e\n\u003cp\u003eJavadocs are \u003ca href=\"http://moagrius.github.com/MapView/documentation\"\u003ehere\u003c/a\u003e.\u003c/p\u003e\n\n\u003ch4\u003eLicense\u003c/h4\u003e\n\u003cp\u003eLicensed under \u003ca href=\"http://creativecommons.org/licenses/by/3.0/legalcode\" target=\"_blank\"\u003eCreative Commons\u003c/a\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoagrius%2Fmapview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoagrius%2Fmapview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoagrius%2Fmapview/lists"}