I'm trying to create a C# application that downloads maps from some Maps Database (OpenStreetMap, Google Maps, Yahoo Maps)
And then to make an API that show me my location on the downloaded maps without being connected to the internet ...?
I found a lot of examples of google offline maps but i cant find something to show your location on downloaded maps using Longitude and Latitude.
As far as i know the GMap.Net control can use a local cache. So you could populate the cache with the tiles you like and afterwards simply change to cache-only mode.
If you look deeper into code it should also be possible to get some data in and out of the cache by some API. So you could download the tiles once and save them to disk. At startup you'll inject the tiles into the cache and set the mode from the beginning to cache-only.
Related
So I am creating an app which will have map with pre added locations (pins) into it and when user comes near that location (s)he will get notification. My problem is, how to add Pins into Xamarin Maps? I am not using Google Maps, I am trying to do with "Xamarin Custom Map?".
I have opened map, but it is opening in Google Maps appliation. I looked for a way not to use Google Maps Api, but I didn't find a single solution how to do this without Google Maps, so is it even possible?
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 20;
var position = await locator.GetPositionAsync(TimeSpan.FromSeconds(20), null, true);
Map.OpenAsync(position.Latitude, position.Longitude);
This code here opens map application on my smartphone (in this case GoogleMaps), so I am wondering is it possible to add pins to it, or somehow open map inside of my app wihtout using Google Maps API?
thx all for feedback, using Google Maps API is easiest and best solution for this! :-)
I'm trying to set up a basic app to call the Google Directions API from a Xamarin.Forms app in Android. I'm new to Xamarin & C# generally, so have struggled searching for the right terms, but am familiar with the directions service from a javascript angle.
I'm using this basic app as a test bed: https://learn.microsoft.com/en-us/xamarin/android/platform/maps-and-location/maps/maps-api
I can add the button and associate a process with it, but how do i call the API & catch the results?
I'll worry about plotting etc later, i just want to write out the results to console for now.
Thanks for your help in advance!
1.First of all, you can used following URL to get Json data.(Please notice:You need to enable the Directions API in Google console,otherwise, you will get error message This API project is not authorized to use this API.)
https://maps.googleapis.com/maps/api/directions/json?origin=lat1,lon1&destination=lat2,lon2&key=yourApiKey
In this URL, you need to provide the latitude and longitude of Origin position and destination postion.API key(You can get the API key from a Google console)
2.You can play and just change variables in this link and open it in browser, to see the returning object like this screenshot.
3.When you receive the return object, you will need to parse it.(Prase json data:http://bsubramanyamraju.blogspot.com/2017/04/xamarinforms-consuming-rest-webserivce_17.html)
4.The distance will be at googleApiRouteObject.routes[0].legs[0].distance; There you will find a int representation in meeters, and string representation like 2km.
5.The waypoints will be coded in Polylines, you will need to parse them. You can find how to do that with code examples here: https://developers.google.com/maps/documentation/utilities/polylineutility
If you want to get the sample code, you can refer to this link.
https://agileapp.co/xamarin-forms-maps-polyline-route-highlighted-google-api
I am working on a Xamarin iOS project trying to display a list of the most likely locations based on the user's GPS coordinates using either the Place Picker or GMSPlacePickerViewController from the google maps API, as shown in this Swift tutorial.
However I can't seem to find any decent tutorials using C#. I don't want to display the map to users I simply want to retrieve the list of most likely locations based on the coordinates.
Any guidance would be greatly appreciated as I'm at a bit of a loss about how to use the google maps API to achieve this.
Okay answering this for anyone coming after me and trying to do something similar.After lots of searching I have realised it is possible to use the nearbySearch method from the Google Places API Web Service to retrieve a list of addresses near particular coordinates within a specific radius (in metres). You can optionally specify the type of addresses you are searching for, e.g. Restaurants.
Not sure how I missed this but there is a Place Search demo at the bottom of this page;
https://developers.google.com/places/web-service/
I'm making a iOS game which will pick a random clue(text) and image (clue and image come in a set, 1 row) from the clue repository in the database. I have a web service with webMethods and functions that allow me to pull the database row out. (tested for clue) I've been searching on Google for articles on how to import image to iOS from db but to no avail.
how to import image from DB by web service (build using c#)? Can anyone please guide me in the right direction? I would like it to be stored in mutableArray so that after the player are done playing, the clue and image will be wipe off the temp array. (i don't want to put the image in the app as that will make the app very large and that user are able to upload their own clues and image, so live feed from database is the ideal method.
Right now I'm stuck on the web service side on importing the image over. I'm currently using List to store the clue, but have no idea on what to use to store image. I am thinking of using ArrayList which store object, but have no idea how to convert it to image at the iOS side. And as I mentioned above, I can't seem to find any tutorial or example that import image to iOS app via web service. (or am I using the wrong search term)
Will be helpful if any1 can help me out, or give alternate solution which enable live update of image and clues.
EDIT - I found ImageList() and List. which one should I be using now?
Also found out to make image file is just -> image testfile;
EDIT2 - problem I'm facing
-dealing with image file (image? imagelist?
-when drawing datarow from DB in webservice, how do i deal with the image file. (guessing ImageList or List<image> (after some luck on research)
-assuming 2nd point works fine, i should be able to solve the client side
(sorry, noobie at webservice, )
.
what I have
-webservice that draw datarow from database for clue(string) (tested and working fine with my function)
-iOS client side with RESTful architecture
.
what I need
-webservice that draw datarow from database for picture(image (format not so important yet)) (code should be similar to drawing clue, only which function to store it in. (using List<string> for clues)
Sounds like you might be getting a bit ahead of yourself. Try solving just one problem at a time; you'll make much more progress.
First, do you know how to download an image to your iOS application? Try downloading a very simple publicly available image like a Google doodle: https://www.google.com/logos/2012/gymnastics-2012-hp.jpg. Whatever IOS application toolkit you're using should have a walkthrough for how to download an image and present it via HTTP.
Second, do you know how to host an image file on your web server? Try downloading a random JPG or PNG image yourself and hosting it on your server as a static file. Then point your IOS application at that static file and download it just like you did with the Google doodle.
If both of those steps work, you can then begin to host dynamic images on your server. Create a page (if you're using ASP.NET) or a controller path (if you're using MVC) and have your C# code use Response.TransmitFile to upload an image to the clickstream. Again, download that image to your IOS application to verify it worked.
Finally, modify your server application to take a parameter - either by a querystring (example: myhost.com/mypage.aspx?image_id=1) or by an MVC path (example: myhost.com/images/1). Use that ID number to retrieve the image information from your database. Then transmit the image to the client. If all goes well, you should then be able to retrieve this image in your IOS app.
I hope this helps you get closer to your project!
I have no experience programming on iOS, but I think that the easiest way is to prepare RESTful api for that. With the REST guidelines in mind, what you end up with is a webservice that defines a resource, and your client needs only to request a particular file (I assume that client somehow knows what the id/name of the image is). This has one big advantage - it is very easy to develop (on any platform) - server side.
When it comes to client side:
1. Use WebRequest object to create a http get request
2. Wait for the data to be downloaded (you may use background worker or just another thread, so that your app is not blocked)
3. When request is complete and you get the response object - read what was sent. It is going to be binary image.
4. Use the binary data (image) and display it in your app.
A sample of how to use WebRequest object is provided by me in different SO thread: https://stackoverflow.com/a/11891240/165751
Note: I assume you know how to retrieve the image from the DB (or any kind of store actually) on your server side so that your webservices can read it and return it as a webresponse.
There are plenty of possibilities when it comes to server side technology, but if you want to stay with .Net technology stack - I suggest to have a look at WCF REST Service Template 40(CS) - I've been using it in the past (and my service was returning images as well :) and I was very happy with it.
I have a requirement to create a web based application, which is hosted on a intranet server(no internet access). This application will be used to keep track of various status over in the various geographical location, the locations are currently spanned within Asia.
I have read up on google map api, and it seems that it is against their policy to use their map offline. On the other hand, the custom markers is something that I am interested in. I am considering to make use of the marker concept to show the status of the area.
Hence sample example of the status can be denoted by having red as error, green as working properly, and this will be updated every 1 hour.
Any bros have done similar concept and will be willing to guide me? The offline maps is preferred to be free, however if a paid version proves to be useful, it can be considered.
Seems like you could use a combination of MapServer as mapping server and openstreetmap as data source (maps for asia are available, but it depends on the level of zoom, precision and update you are willing to work with) and OpenLayers to load, display and render your markers and data.
Links :
MapServer :http://mapserver.org/index.html
OpenStreetMap : http://www.openstreetmap.org/
OpenLayers : http://openlayers.org/
Notice : you can find .shp versions of openstreetmap for offline viewing and usage, free of charges, here : http://downloads.cloudmade.com/ , and here : http://download.geofabrik.de/osm/
And here is a MapServer Tutorial for C# mapscript (ASP .NET) : http://www.paolocorti.net/2006/09/20/mapserver-tutorial-for-c-mapscript-asp-net/
Google Maps/Earth will only allow you to store 2Gb of map data locally. The API will not let you store any at all. There is no way to use the maps offline. However you can try downloading images from NASA World Wind: http://worldwind.arc.nasa.gov/java/ it is opensource.