I would like to create an offline Android app that can read shapefiles and generate maps as created on ArcGIS. I tend toward using Python for it.

How do I go about it?

closed as too broad by Vince, PolyGeo May 5 at 22:00

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Reading shapefiles is a matter of a hundred lines of code. Mapping like ArcGIS is closer to a million lines of code. Any way you stack it, this question is far too broad for GIS SE, which specializes in focused questions. Please take the Tour and review the help page for off-topic subjects. – Vince May 5 at 13:28

Python is not the best option there, but it is doable for sure.

I would suggest two libraries:

  1. Kivy - to build a basic mobile app
  2. Matplotlib - to visualize shapefiles (and other spatial formats)

You will also need another library to extract geometry from the shapefile, pyshp could be a good choice.

To use matplotlib with kivy you can use kivy-garden which contains all necessary bindings. Here is a simple example how to use these libraries to display the most simple plot:

from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
import matplotlib.pyplot as plt

plt.plot([1, 2, 3, 4, 5])

class ExampleApp(App):

    def build(self):
        box = BoxLayout()
        return box


And displaying shapefiles in matplotlib minimum example is:

import shapefile as shp
import matplotlib.pyplot as plt

your_shapefile = shp.Reader("path/to/file.shp")

for shape in your_shapefile.shapeRecords():
    x = [i[0] for i in shape.shape.points[:]]
    y = [i[1] for i in shape.shape.points[:]]

Of course there are multiple possibilities and useful features in both.

Not the answer you're looking for? Browse other questions tagged or ask your own question.