Google Maps API alternative

  1. 8 months ago

    Boudewijn K

    9 Jan 2019 Pre-Release Testers, Xojo Pro Amsterdam NL, Fischer Tx

    As Google is now charging a lot more for using the Google maps API, has anyone found a good alternative and is willing to share a desktop example of how to use it?
    Although it's not hard to get a Google API, they do now require payment. @Paul L : Maybe you could help us out here?
    The current implementation gives a warning and no longer shows maps for free.

  2. For my windows app, I am using Leaflet https://leafletjs.com which is a Javascript which works with OpenStreet Map. You should be able to use the HTMLViewer to show the map.

  3. Javier M

    9 Jan 2019 Pre-Release Testers, Xojo Pro, Third Party Store AprendeXojo - Europe, Spain

    Hi Boundewijn,

    LeafLeft works great for me. I'm just using it for the basic of showing the coordinates spot in the map, but the API provides much more advanced stuff that you can implement too.

    Javier

  4. Boudewijn K

    9 Jan 2019 Pre-Release Testers, Xojo Pro Amsterdam NL, Fischer Tx

    @Edwin L & @Javier Meacute;ndez : thanks for the quick reply, but at first glance this does not offer showing a map based on address input, but based on GPS coordinates only. Can anyone share an example of an alternative using a street address as an input?

  5. Valdemar D

    9 Jan 2019 Pre-Release Testers, Xojo Pro Europe ( France, Paris )

    For me, I'm gonna use the new @ChristianSchmitz MBS plugin using Apple MapKit. Changing from Google API take me a few minutes for a very nice result.

  6. Boudewijn K

    9 Jan 2019 Pre-Release Testers, Xojo Pro Amsterdam NL, Fischer Tx

    @Valdemar Dnbsp;SOUSA Thanks, I'm a big fan of MBS and did not know Christian has an alternative: I'll have a look.

  7. Edited 8 months ago

    @BoudewijnKrijger @Valdemar Dnbsp;SOUSA Thanks, I'm a big fan of MBS and did not know Christian has an alternative: I'll have a look.

    I am using Christian MBS's Apple MapKit https://www.monkeybreadsoftware.net/topic-mapkit.shtml for the Mac which works great if you are only deploying for the Mac. It would not however work for Windows.

    Leaflet on it's own would require coordinates to show the map so since they are using OpenStreetMap, what I did to convert address to Coordinates is to make a call to their OpenStreetMap Search server. In the below example, I search for the Empire State building to get back a Json File which I would search for the Lat and Long values to use with Leaflet.

    https://nominatim.openstreetmap.org/search?format=json&q="Empire State Building"&addressdetails=0

  8. Jean-Yves P

    9 Jan 2019 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    you also have openstreemap that is completely free.

  9. Joost R

    9 Jan 2019 Pre-Release Testers, Xojo Pro The Netherlands

    @Javier Meacute;ndez LeafLeft works great for me. I'm just using it for the basic of showing the coordinates spot in the map, but the API provides much more advanced stuff that you can implement too.

    @Javier Meacute;ndez - are you willing to share just a small peace of code, just to kick off quickly. ?

  10. Javier M

    9 Jan 2019 Pre-Release Testers, Xojo Pro, Third Party Store AprendeXojo - Europe, Spain

    Hey @Joost R!

    What do you prefer more? A snippet of code or a video tutorial / blog post about how to use it? :-)

    Javier

  11. Joost R

    9 Jan 2019 Pre-Release Testers, Xojo Pro The Netherlands

    @Javier Meacute;ndez What do you prefer more? A snippet of code or a video tutorial / blog post about how to use it? :-)

    I guess you have a lot of work to do Javier, so I chose what is appropriate for you. it would be a great service for many of us.

  12. Martin T

    9 Jan 2019 Pre-Release Testers Germany

    @Javier Meacute;ndez What do you prefer more? A snippet of code or a video tutorial / blog post about how to use it? :-)

    Javier, could you please show us, how to get a map as a Picture into a Desktop App (in a Canvas) without using HTMLViewer? Would be nice, thanks.

  13. Javier M

    9 Jan 2019 Pre-Release Testers, Xojo Pro, Third Party Store AprendeXojo - Europe, Spain

    (I'll take an eye on the Picture option, meanwhile for the HTMLViewer based version…)

    I'll try summarize what I do (sorry in advance for not add explanations to the snippets of code):

    1. I have an HTML Subclass with a kHTMLSourceCode constant whose content is (easy to modify to adequate to other purposes or delete something). You should substitute the "TOKENTOKENTOKEN" string for your own:

    <!DOCTYPE html>
    <html>
    <head>
    	<meta charset="utf-8" />
    	<meta name="viewport" content="width=device-width, initial-scale=1.0">	
    	<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
        <link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css" integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==" crossorigin=""/>
        <script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js" integrity="sha512-nMMmRyTVoLYqjP9hrbed9S+FzjZHW5gY1TWCHA5ckwXZBadntCNs8kEqAWdrb9O7rxbCaA4lKTIWjDXZxflOcA==" crossorigin=""></script>
    </head>
    <body>
    <div id="mapid" style="width: ##W##px; height: ##H##px;"></div>
    <script>
    	var mymap = L.map('mapid').setView([##LAT##,##LONG##], 13);
    	L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=TOKENTOKENTOKEN', {
    		maxZoom: 18,
    		attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
    			'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
    			'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
    		id: 'mapbox.streets'
    	}).addTo(mymap);
    	var marker = L.marker([##LAT##,##LONG##]).addTo(mymap);
    </script>
    </body>
    </html>

    2. Then, the subclass has the method (among others) LoadMap( longitude as String, latitude as String ) with the following code:

    coordinates = new pair(0,0)
    
    Dim sourceHTML As String = kHTMLSourceCode.ReplaceAll("##LONG##", longitude)
    sourceHTML = sourceHTML.ReplaceAll("##LAT##", latitude)
    
    Dim tHeight As Integer = Me.Height
    Dim tWidth As Integer = Me.Width
    
    sourceHTML = sourceHTML.Replace("##H##", tHeight.ToText)
    sourceHTML = sourceHTML.Replace("##W##", tWidth.ToText)
    
    Me.LoadPage(sourceHTML, SpecialFolder.Temporary.Child("Map") )
    
    coordinates = new pair(longitude, latitude)

    Forget about the Coordinates property (I use it for other things).

    Javier

  14. Joost R

    9 Jan 2019 Pre-Release Testers, Xojo Pro The Netherlands

    Thanks a lot @Javier Meacute;ndez - Got me a token, put this sample together and have a flying start. And as you know, a good start is half the work. :)

  15. Paul L

    9 Jan 2019 Xojo Inc, Third Party Store http://docs.xojo.com

    I switched the Eddie's Electronics desktop demo app to use MapBox instead of Google Maps for 2018r4:

    Examples/Sample Applications/EddiesElectronics/Desktop

    CustomerDetailsWindow.RequestMap sends the request to a LocationSocket to get a geocode location for the address. The LocationSocket.PageReceived event sends a request to MapSocket to get the map as a Picture. The MapSocket.PageReceived event converts the returned binary data to a Picture which is displayed by MapCanvas.Paint.

  16. Lars L

    9 Jan 2019 Pre-Release Testers, Xojo Pro Europe (Germany, Chemnitz)
    Edited 8 months ago

    Our whole business with it's applications are leaflet and openstreetmaps based.

    We wrote our own leaflet controls, together with the apis of graphhopper.com. Additional, we use Mapbox Studio to design our maps the way we like.

    So: I can highly recommend this toolset: leaflet.js, graphhopper, mapbox studio (free) and own written controls.

    I'll attach some screenshots of our apps to show the possibilities.
    https://github.com/VanDerLars/upload_stuff/blob/master/Bildschirmfoto%202018-02-07%20um%2011.34.13%20(2).png
    https://github.com/VanDerLars/upload_stuff/blob/master/Karte.png

  17. Christian S

    9 Jan 2019 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    See my blog post:

    https://www.mbsplugins.de/archive/2019-01-08/MapKit_Framework_for_Xojo

    You can show map, get directions and find local items on the map.

  18. Martin T

    9 Jan 2019 Pre-Release Testers Germany

    @Paul L I switched the Eddie's Electronics desktop demo app to use MapBox instead of Google Maps for 2018r4

    Thanks Paul, didn't saw this. Looks like the MapPicture is in low resolution. Any chance to get it in high resolution e.g. for Retina Displays?

  19. How about Here ?
    It's free for up to 250k transactions per month

  20. Joost R

    9 Jan 2019 Pre-Release Testers, Xojo Pro The Netherlands

    @Steve W How about Here ?

    It provides (reverse)geocoding, address-autocompletion etc.

  21. Newer ›

or Sign Up to reply!