posm / OpenMapKitAndroid

http://openmapkit.org
BSD 3-Clause "New" or "Revised" License
128 stars 38 forks source link

Android based way to create MBTiles #24

Closed jj0hns0n closed 8 years ago

jj0hns0n commented 9 years ago

We need a way to run this process [1] with a map based interface.

[1] https://github.com/AmericanRedCross/openmapkit/wiki/Creating-Your-Own-MBTiles-Basemap-File

hallahan commented 9 years ago

Absolutely! Next phase feature for sure.

hallahan commented 9 years ago

This could be pretty cool to integrate with Field Papers. Build an MBTiles Field Papers export.

I'm thinking rather than scraping tiles from the app, we should simply download an MBTiles from a web service. This will be much faster than pulling millions of tiny PNGs down through.

dalekunce commented 9 years ago

totally agree that we should have a server make the mbtiles file for us. Then notify when its ready.

jj0hns0n commented 9 years ago

Is there some existing service that already does this?

On Wed, Apr 1, 2015 at 4:20 PM, Dale Kunce notifications@github.com wrote:

totally agree that we should have a server make the mbtiles file for us. Then notify when its ready.

— Reply to this email directly or view it on GitHub https://github.com/AmericanRedCross/OpenMapKit/issues/24#issuecomment-88662073 .

hallahan commented 9 years ago

Not that I know of. Sounds like a great project idea!

jj0hns0n commented 9 years ago

Unfortunately, I cant really get the tl copy command to work reliably for me. It creates the file and loads the first few zoom levels and then I see a bunch of error trace like below.

Error: connect EMFILE
    at errnoException (net.js:904:11)
    at connect (net.js:766:19)
    at net.js:845:9
    at asyncCallback (dns.js:68:16)
    at Object.onanswer [as oncomplete] (dns.js:121:9)
Error: connect EMFILE
    at errnoException (net.js:904:11)
    at connect (net.js:766:19)
    at net.js:845:9
    at asyncCallback (dns.js:68:16)
    at Object.onanswer [as oncomplete] (dns.js:121:9)
Error: connect EMFILE
    at errnoException (net.js:904:11)
    at connect (net.js:766:19)
    at net.js:845:9
    at asyncCallback (dns.js:68:16)
    at Object.onanswer [as oncomplete] (dns.js:121:9)
Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)
Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)
Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)
Error: getaddrinfo ENOTFOUND
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:124:16)

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: SQLITE_CANTOPEN: unable to open database file
scylax:~ ortelius$ 
jj0hns0n commented 9 years ago

fwiw, I found a python lib to reliably create mbtiles from osm

https://github.com/makinacorpus/landez

mojodna commented 9 years ago

@jj0hns0n what platform are you on? what's the full command you're using?

mojodna commented 9 years ago

It's possibly related to setting http.globalAgent.maxSockets = Infinity on Node < 0.12. I ran into a similar problem (socket timeouts instead) and manually changing it to 50 (an arbitrary value) made all of the errors go away.

jj0hns0n commented 9 years ago

Forgive this node n00b, but where do I do that?

On Wed, Apr 8, 2015 at 9:45 PM, Seth Fitzsimmons notifications@github.com wrote:

It's possibly related to setting http.globalAgent.maxSockets = Infinity on Node < 0.12. I ran into a similar problem (socket timeouts instead) and manually changing it to 50 (an arbitrary value) made all of the errors go away.

— Reply to this email directly or view it on GitHub https://github.com/AmericanRedCross/OpenMapKit/issues/24#issuecomment-91114260 .

mojodna commented 9 years ago

Edit node_modules/tilelive-http/index.js and change Infinity to 50 (or something). (After installing tl with npm install tl; it it's global, it'll be beneath in Node's lib/ directory, wherever that happens to be.)

hallahan commented 9 years ago

/usr/local/lib/node_modules for me

mojodna commented 9 years ago

It doesn't look like it fully solves the problem (tilelive-http should probably retry when encountering internal errors or remote 5xx errors), but it's dramatically better.

mojodna commented 9 years ago

tl@0.3.2 and tilelive-http@0.6.0 improve this behavior (except for tile servers that don't just briefly serve 5xxs).

hallahan commented 9 years ago

Sweet! I wonder how much effort it would be to create a micro service that runs tl and provides a url to mbtiles when it's done?

dalekunce commented 9 years ago

I would like to see this as a part of the OMK server. Will need to figure out how best to plug this into the work that @mberg is doing for a later stage.

hallahan commented 8 years ago

This will be a major feature of OpenMapKit Server, and MBTiles will be delivered as part of the provisioning.

https://github.com/AmericanRedCross/OpenMapKitServer