RectLatLng (SelectedArea) read only?

Topics: Help
Jan 30, 2011 at 7:23 AM
Edited Jan 30, 2011 at 7:24 AM

VS2008 is tellling that RectLatLng is read only when I try to set values for .Top, .Bottom, .Left, .Right in my version of the prefetcher.  What I want to be able t do is type into textboxes the boundaries of the SelectedArea:

double north = 48; double south = 47; double west = -123; double east = -122;

SelectedArea.Top = north; SelectedArea.Bottom = south; SelectedArea.Left = west; SelectedArea.Right = east;

Is there a way to do this without changing the GMap.NET.Core? or what all do I have to change in the core to be able to make this work?

 

Thanks

Jan 30, 2011 at 8:28 AM

OK, I figured it out after playing around with the code for a few minutes.

public RectLatLng area;

area = new RectLatLng(double lat, double lng, double widthLng, double heightLng);

And I wrote it in as:

area =

new RectLatLng(north, east, (east - west), (north - south));

 

Now I just have to figure out how to get the rectangle to draw properly on the map. :)

Jan 30, 2011 at 2:49 PM
Edited Jan 30, 2011 at 2:59 PM

public RectLatLng SelectedArea, just assign your wanted value and it will draw it for you

p.s. demo MainMap.SelectedArea = MainMap.CurrentViewArea;

Feb 8, 2011 at 7:10 AM
Edited Feb 8, 2011 at 6:34 PM

Thanks for that. I got it working so an area can be selected by ether entering the values manually or by using the <alt> + <leftMouseClick>.

Now to the real issue.....I think I found the code I need to edit so that the application will only export part of the map data cache instead of the entire cache.

GMap.NET.CacheProviders - SQLitePureImageCache.cs - ExportMapDataToDB - Lines 317-348

Really, I think the only line I have to change is:

using(SQLiteCommand cmd = new SQLiteCommand("SELECT id, X, Y, Zoom, Type FROM Tiles;", cn1))

so that it only exports one tile at a time from the selected map from the selected zoom level.

Example:

Export tile {0,0} from zoom level 0 from OpenStreetMap.

Export tile {164,360} from zoom level 10 from OpenStreetMap.

I know I'll have to create a few if or while loops to get all the tiles in a selected area ( {163,358} to {165,360} is 9 tiles) but I need to get that SQLiteCommand() figured out first.

Any ideas?

Thanks again.

Feb 8, 2011 at 12:09 PM

maybe SELECT id, X, Y, Zoom, Type FROM Tiles WHERE X >= 0 && x <= 164 && Y >= 0 && Y <= 360