Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MapWinGIS the GREAT little OCX that could MAP!
Message
De
13/05/2020 11:04:13
 
 
À
13/05/2020 09:48:08
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01674384
Message ID:
01674388
Vues:
96
Hi Greg,

That's a bit difficult since my code samples but let us start with the ocx startup code. Of course beforehand, you download the ocx from github and make it is setup and registered. Then you can push the ocx on your form and set up a few options in init code:

WITH THISFORM
WITH .MapCtrl
.GrabProjectionFromData = .T.
.TileProvider = - 1 && no tile provision
.Projection = 0 && 0 = None 2 = GOOGLE_MERCATOR
.ShowZoomBar = .F.
.ZoomBehavior = 0 && infinite zooming (targeted at tile-providers datasets) is disabled!
.ShowCoordinates = 0
.CursorMode = 0
.ScalebarVisible = .F.
.UseSeamlessPan = .T. && might have a CPU cost!
ENDWITH
ENDWITH

Then you push a few VFP COMMAND buttons on your form. I'd recommend you have:
1) a "pan the map" one with THISFORM.cursorMode = 2 in the click action,
2) a "zoom mode" one with THISFORM.cursorMode = 0 in the click action,
3) ... Of course the most useful that set up the map either as an "Internet free" dataload of a standard "shape file" (shp extension) or the more recent kml (google format) or geosjon format. The code may be something like:

cShapeFileName= GETFILE("SHP:shp;GEOJSON:geojson;KML:kml")
WITH THISFORM
WITH .MapCtrl
.removeAllLayers()
.addLayerFromFilename(cShapeFileName,0,.T.)
** some color settings for the different "shapes" polygons that build up your map
.ShapeLayerDrawFill(0)= .T.
.ShapeLayerFillColor(0)= Rgb(239,239,239)
.ShapeLayerLineColor(0)= RGB(128,128,128)
.ShapeLayerLineWidth(0)= 1
ENDWITH
ENDWITH

RETURN

The sample explores local resources. But should your application partly rely on Internet access, you could of course setup your map as a display of internet resources called map-services. Pushing this snippet in, say, your init code:

WITH THISFORM.MapCtrl
.TileProvider = 0 && i-e tkTileProvider.OpenStreetMap
.KnownExtents = 70 && tkKnownExtents.keFrance
.Projection = 2 && MERCATOR
ENDWITH

RETURN

... Will call a tile-service such as openstreet map (see attachement). Delivery of the "tiles" is of course in the hand of a third-party. And this one is clearly not making money with the service. Speed may vary. But I expect you find one with robust speed. As far as our users are concerned, we are building decision-support material that require limited information, basically simple maps with very limited content.

In our case, we use zero Internet material. The shapes provide use are shp files that are static and change quite rarely : geographical maps. They are workstation material and the content onto the map (texts, images) are delivered ie placed onto the map by ourselves using customer database material as source. That takes a bit of work but can be done.

GIS technology can be daunting. And you will need definitely some time to get started. But I hope these few lines of code may be helpful to get the picture on this nice open source material. It is worth the trip. The local stuff is very speedy!

Daniel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform