2

I used the Create Mobile Map geoprocessing tool in ArcGIS 10's toolbox to generate a mobile map from an MXD. The MXD has one layer which featureclass is:

1) in a geodatabase
2) registered as versioned and 
3) has a globalid

all the ridiculous requirements for generating a mobile cache just to take advantage of ArcGIS Mobile's mapping capabilities (like I couldn't send my edits back to my own webservice and manage edits my own way).

I then took the MapSchema.bin file and dropped it in a folder on my Windows Mobile device. I wrote a small test Smart Device application in Visual Studio that has this code:

        using (MobileCache cache = new MobileCache(mobileCachePath))
        {
            cache.Open();

            FeatureLayer layer = cache.Layers[0] as FeatureLayer;
            FeatureDataTable table = layer.GetDataTable();

            FeatureDataRow row = table.NewRow();
            row["area_id"] = 1;
            table.Rows.Add(row);

            int recordsAffected  = table.SaveInFeatureLayer();
            //recordsAffected is always 0


            using(FeatureDataReader reader=layer.GetDataReader(null,null))
                while (reader.Read())
                {
                    //never reaches here
                }

            table = layer.GetDataTable(new QueryFilter("area_id="+1));
            int foundRows = table.Rows.Count;
            //foundRows is always 0

            cache.Close();
        }

As you can tell from the comments in the code, I can't find my new records anywhere. I open the MobileCache.db file in a Sqlite browser and the tables are empty. I read that I could use the MobileCache in a headless fashion, is this not what ESRI meant? Can anyone fill me in on what I'm missing? OR EVEN BETTER does anyone know another mobile mapping API that is SIMPLE (just plot stuff on a map already for crying out loud), works with locally stored maps and stores geometry in some open format?

1 Answer 1

1

So I found the answer and it has to do with more requirements:

1) MXD's main frame must have extent specified explicitly and
2) All new records created in ArcGIS Mobile must have a geometry and the geometry must be within the extent of the frame of the source MXD. The code above will work fine if I add this:

row[table.GeometryColumnIndex] = new Point(-68.939635, 50.151936);

I'm not so mad anymore now I got it working. I mean I still have to find a way to work with tons of records that have no spacial information which need to be searched and geo tagged from the device but whatever.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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