Android Send/Receive data with Arduino using Bluetooth – Part 2

Harry's Developer Blog

To get things moving along quickly I am going to use the same activity that I used in the last blog to find my paired devices. This can be found here. Only one thing will change and that is the activity name. Call it DeviceListActivity, as it is no longer the main activity.

Also make sure that you update your permissions in the manifest to allow bluetooth (and the DeviceListActivity name if you didn’t start a new project from part 1).

Now on to the new stuff! We are making an activity that will allow us to turn on/off an LED on the Arduino as well as receive data via bluetooth. When finished it will look like the image below. Screenshot_2014-04-12-01-40-22 As we are sending and receiving data this time through Bluetooth rather than just sending there are a few more things to take care of.

First of all is…

View original post 490 more words

Anrdroid Send/Receive Data With Arduino Via Bluetooth – Part 1

Harry's Developer Blog

In the last three posts I went through the basic steps to send data from an Android device to an Arduino using a bluetooth serial module. That was fun and all but it would be better if the Arduino could send data back to the Android device. With functionality like that there a lot more plausible uses for the technology. For this example I am going to go through the steps to make a 4 channel voltage logger but with a few minor changes this could be used to send/receive practically anything.

All files used are available on GitHub here.

Like last time, lets get the Arduino stuff out of the way first. For this project I have made a simple sketch and circuit that takes four analog inputs A0-A3 and then converts the values to 2dp float voltage values. The values are then displayed on the LCD screen…

View original post 454 more words

MapIt GIS – Spatial Asset Collection, GPS Surveys and Spatial Data Management for Android

Please check out my new app for Android.

More details:
Get the app from Google Play

– Mobile app for asset collection, data management and environmental surveys.
– Survey layers (point, line, polygon).
– Attributes management.
– Google Maps, Bing Maps, Open Street Map base maps.
– Support for offline maps & Mapbox maps.
– Export, Import, Share (CSV, KML, geojson, arcjson).
– Measurement of the area, perimeter and distance.
– Support for multiple measurement units.
– Support for number of local coordinate systems.



Typical usage: environmental surveys, soil surveys, trees surveys, soil types mapping, mapping ecosystems, contractions, land measurement, real estate mapping, snow removal and many other to discover…

Related article:

Creating OSM Offline tiles using Maperitive

MapIt offline extension is allowing to use prepared earlier basemaps when there is no Internet connection available. Please follow this guide to create .mbtiles file which you can then use as an alternative base map.

There is number of commercial application allowing you to create such a file, but in this article we will focus on the open source solution and the Maperitive software.

You can download the application from here. You need to unzip the file, and run Maperitive.exe. Maperitive may take a while to start up, just wait.

Linux or Mac OS X users can follow this guide to install the software.

The full documentation for the Maperitive is available here, however following this sample guide you will be able to create the offline map just in few minutes.

1. Open the software and zoom to the area of your choice. You can add more web maps (e.g. Open See Map if required)


2. Set Geometry Bounds for your area


3. Zoom-out slightly to see the selected area – you can modify the rectangle if you wish.


4. Download OSM data for selected area.


5. Wait until the OSM data will be downloaded from the server:


6. Ones the data is downloaded remove Web map (OSM Mapnik) from the map viewer – this is not necessary, but will speed up the generation of the tiles.


7. If you like Hill Shading – you can apply the preset template. The necessary high data will be automatically downloaded.



8. If you need you can add contours to your map as well.


9. Ones you are happy with the map, you can zoom-in or pan around to check the details you need to generate the offline tiles. This operation may take a while and depends from various factors like the performance of the PC, selected zoom-levels etc.


You can read more about the consequences of the zoom-level selected here.

I would strongly recommend that you do not use zoom levels above 17 when creating offline tiles. Usually level 16 or 17 is enough for most activities.

When you are happy with all the map settings please follow this guide to generate the mbtiles file.

Basically you need to run a command like:

generate-mbtiles minzoom=0 maxzoom=17

From my our personal experience is better that you generate more smaller files than one big one for huge area, however it’s entirely up to you and you may prefer other options.

The generated file will be located in the Tiles folder, you can rename it before copying it over to device SD card:



10. The offline map can be set as default using the extension and used without Internet connection.

Screenshot_2015-02-14-03-04-18 Screenshot_2015-02-14-02-58-52


Generating mbtiles from an image

In number of emails I have been asked how to create an offline map from geo-referenced image. Please follow this article to create .mbtiles file ready to use with MapIt from an image. We use open source software to achieve the goal.

You need to have:

Please follow the steps below to get the offline map of Kilimanjaro in format compatible with MapIt:

1. Open qGIS and open a Georeferencer plugin as shown below:

qGIS Georeferencer plugin
qGIS Georeferencer plugin

2. Add your image to the plugin and set the spatial reference – you can use filter typing 4326 in the filter box.

Choose WGS84  spatial reference for your image
Choose WGS84 spatial reference for your image

3. Selecting georeferencing points.

Depending from the type of image you may use 4 or more points to georeference an image.
Zoom to the upper right corner and add point then enter longitude and latitude of that location:

Add lat, lon for the image corner.
Add lat, lon for the image corner.

Add another 3 points. Please make sure, that your working diagonally. In our example it would be: upper left, lower right, upper right, lower left. This will minimize problems according to the visibility of the map during georeferencing it.

Georeferencing points added to the image.
Georeferencing points added to the image.

4. Transformation settings

Before we georeference the image please go to Settings and set Transformation settings as shown on the picture below:

Georeference an image - transformation settings
Georeference an image – transformation settings

5. Georeference the image and add it to qGIS map view to check out if everything is fine.  Go to the used crossings of longitudes and latitudes and compare the shown coordinates with the desired coordinates. If they fit, you are done and ready for next step.

6. Before we use the image in Maperitive we need to convert the wld file (created during the georeference process above in the same location as the image) to georef file used by Maperitive.

Make sure that the number of decimal digits for the cell size is not>17 in georef file, otherwise Maperitive will complain.

Conversion of world file (wld) to georef file
Conversion of world file (wld) to georef file

World file content:


georef file content:


8. Open Maperitive and type command:



load-image file=Data\kilimanjaro.png background=false 

Maperitive load-image
Maperitive load-image
Georeferenced file loaded to Maperitive
Georeferenced file loaded to Maperitive

9. Generate .mbtiles file – please type the command below changing the zoom levels if necessary:

generate-mbtiles minzoom=0 maxzoom=15

Generate mbtiles
Generate mbtiles

10. rename the generated file to whatever name you want:


11. Copy the file to the device memory card to MapIt->OfflineMaps folder:

phone offlinemaps

12. If you have MapIt offline maps extension your map will be available and ready to use – enjoy…

Offline Map within MapIt app.
Offline Map within MapIt app.

Oracle spatial and the web mercator spatial reference system

Vishful thinking...

We have been attempting to streamline the way we store and process spatial data in Oracle. Normally, we would create our spatial tables as FeatureClasses from ArcCatalog and create plain old Oracle tables for our business/attribute data that would be joined with the spatial data in the FeatureClasses through a shared key field to create a SDE spatial view. This works just fine, but there are some drawbacks to this approach

  • SDE creates unnecessary fields on the FeatureClass table in Oracle, like the field cad annotation that just don’t need to be there.
  • Creating FeatureClasses manually from ArcCatalog is a process that cannot be automated as a part of the build process. Ideally, we like to execute a command from our build scripts that will delete our entire model from the database and run another command to recreate the entire model to start off with a clean slate for testing our…

View original post 982 more words

TileCutter update – With support for OSM and WMS map services

Vishful thinking...

I just added support for creating MBTiles caches for WMS map services and also to download OSM tiles into the MBTiles format. MBTiles cache for WMS map services would improve map rendering performance, but why did i add support for OSM tile sets? Well, they will come in handy for disconnected/offline use cases. So, here are some usage examples

ArcGIS Dynamic Map Service:

TileCutter.exe -z=7 -Z=9 -x=-95.844727 -y=35.978006 -X=-88.989258 -Y=40.563895 -o=”C:LocalCacheags.s3db” -t=agsd -m=””

WMS Map Service 1.1.1:

TileCutter.exe -z=7 -Z=9 -x=-95.844727 -y=35.978006 -X=-88.989258 -Y=40.563895 -o=”C:LocalCachewms111.s3db” -t=wms1.1.1 -m=””

WMS Map Service 1.3.0:

TileCutter.exe -z=7 -Z=9 -x=-95.844727 -y=35.978006 -X=-88.989258 -Y=40.563895 -o=”C:LocalCachewms130.s3db” -t=wms1.3.0 -m=””


TileCutter.exe -z=7 -Z=9 -x=-95.844727 -y=35.978006 -X=-88.989258 -Y=40.563895 -o=”C:LocalCacheosm.s3db” -t=osm -m=””

And always just type “TileCutter -h” for usage information.

Want to customize the parameters with which the maps are being generated? Just use the “-s” command line option ans specify the setting in a…

View original post 109 more words