i have a problem about the Strings, eventually my application is connecting to google map API and I'm getting the Json from the google map API and send the result to Snap to the Road but the problem when I'm trying get from Long distance and the result of are like the link below and x10 of this result,
https://roads.googleapis.com/v1/snapToRoads?path=14.56342,121.01886%7C14.56287,121.02034%7C14.56272,121.02076%7C14.56271,121.0208%7C14.56271,121.02084%7C14.56289,121.02233%7C14.56223,121.02246%7C14.56198,121.02006%7C14.56186,121.02007%7C14.56124,121.02014%7C14.56114,121.02016%7C14.56108,121.02017%7C14.56104,121.02019%7C14.56098,121.02023%7C14.56092,121.02027%7C14.56086,121.02034%7C14.56064,121.02065%7C14.56055,121.02079%7C14.56051,121.02086%7C14.56047,121.02092%7C14.56043,121.02103%7C14.56039,121.02116%7C14.56036,121.02132%7C14.56035,121.02145%7C14.56034,121.02158%7C14.56035,121.0217%7C14.56037,121.02182%7C14.56049,121.02245%7C14.5605,121.02252%7C14.55958,121.02277%7C14.55942,121.02223%7C14.55892,121.02232%7C14.55885,121.02183%7C14.55885,121.02165%7C14.55885,121.02152%7C14.55887,121.02139%7C14.5589,121.02125%7C14.55893,121.02117%7C14.55902,121.02099%7C14.55944,121.02035&interpolate=true&key=AIzaSyBQM6p5dib2aaxPB-mH0nYHPsAikvA14Mo
How can i send it without cutting the strings?
Thank you
Here is the example strings, that im getting the Json map
https://www.dropbox.com/s/qb55e2wk1c4blia/Example.txt?dl=0
you may download the txt file and see the brunch of points from google map api collections
Related
I am new to android development but familiar with java. I want to send a request (containing coordinates of locations) to google maps api for distance matrix and later calculate the sum of distances for each point. The response from api is either in javascript or xml (i dont really know which one). How do i send the query in java and how do i extract the distances from the response?
Try using seperate classes to send and recieve data through the Google maps API. try using JSON to send aaplication data.
In order to use any thing like this (or that is owned by google etc.. ) You first need to setup a developer account at https://play.google.com/apps/publish/signup/
It does cost 25 dollars but in all honesty it's worth it as you get access to a lot of different things including the google maps api, if you're not interested in spending the $25 I would suggest looking into an alternative mapping api.
If on the other hand you will spend the money they've got some great tutorials laid out in the documentation!
A Google Maps Distance Matrix API request takes the following form:
https://maps.googleapis.com/maps/api/distancematrix/output?parameters
If you need more information, Refer to "Distance Matrix Requests".
https://developers.google.com/maps/documentation/distance-matrix/intro#DistanceMatrixRequests
You can also use the "getDistanceMatrix" that issues a distance matrix request.
https://developers.google.com/maps/documentation/javascript/3.exp/reference#DistanceMatrixService
I know normal parsing in Android and Java .
But , here the case is bit different .
In cases when the default String (300) is set I can fetch JSON String with PAGESIZE being set as somewhat 2096 and I can generate code in Sybase.
But if I want to get data as large which is more than size 300 characters or if 300000 characters then the MBO hit can get it but not via code in Android .
In android code I get TRUNCATED data + some data of JSON fetched after I hit for synchronize
So I need to know how can I fetch large JSON string as result via Android code
.
Kindly note : This question is for Sybase Android application development
A similar question has been posted in SAP forum but yet to answer
http://scn.sap.com/thread/3738150
for large data try to save your data in a database from the
beginning (it's a better practice), then deal with it using SQLite.
Lets asume when you talk about fetching you mean fetching data from a server. 2 years ago the most robust approach was to use the gson library for android to parse the json string element by element.
I am trying to get the location (preferably city name) based on any image uploaded. I can see similar functionality used in Google image search where we drag drop an image and it gives a lot of information including location. Is there any API (or any other way) through which I can get similar sort of information? I have checked tineye but it requires commercial license so can't use that
I got a solution for this. Basically its using multiple google apis to get one result
Google Image Search API
call the JSON api https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=http://www.aparisguide.com/eiffeltower/eiffel-tower1.jpg
This will result json with information/content about image. We can use this content in step 2
Google Search api with the content or title obtained from previous search, try accessing google search api http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=Eiffel%20Towerthis will return the lat and lng for search results as JSON
Google geocode api with the available lat and lng from previous search we can call the geocode api as below http://maps.googleapis.com/maps/api/geocode/json?latlng=48.858228,2.294388&sensor=truethis will again return JSON with the list of possible address. With little processing of data it can give me the City.
Note: The results are not very consistent but it can solve the purpose to some extent
I have a page where the user enters the starting point and ending point and I show de route in the map. I would like to know how to get this polygon (polyline) and save it in Postgis through the Java / Hibernate.
Someone can help me?
Thanks.
Luciano
Usually you cannot get that polyline as vector data coordinates, because these data are provided either by Teleatlas / Tomtom (via Google service) or Microsoft Bing (Navteq data) or Nokia (Navteq data)
Such vector data are extremly expensive, and therfore you can only request that a line is drawn on the screen, but you will not get the geographical coordinates (latitude, longitude). Even Google would not have the right to give you that vector data (because they dont own that data, they only display it).
However, I remeber a post here showing how to use an unofficial Google server where you can request the route between two geo points, and get back a compressed encoded route.
But you legally cannot use that service, nor I do know if it yet exists.
An alternative would be use open source map data, like OpenStreetMap, for these services you can get the vector data for a route. For example: the ios RouteMe library provides such things via OpenStreetMap.
I'm using mapquest java library for Android. Actualy I have simple android application with map and I can determine route between two locations. The thing I need to do is to get geopoints of this route. The code below is from samples of mapquest.
routeManager.setRouteCallback(new RouteManager.RouteCallback() {
public void onSuccess(RouteResponse routeResponse) {
clearButton.setVisibility(View.VISIBLE);
if (showItineraryButton.getVisibility() == View.GONE &&
showMapButton.getVisibility() == View.GONE) {
showItineraryButton.setVisibility(View.VISIBLE);
}
createRouteButton.setEnabled(true);
}
});
The routeResponse object has a serviceResponse field of jsonObject type. One of the elements of this jsonObject is field called "shapePoints". The documentation of the RouteResponse sais that routeResponse field should have an array of geopoints pairs. I'm not getting this array, but some kind of hashed string :/ :
"shapePoints":"gvxpjAfxthgEkF?cQ]yQ?umA?qMOog#Oej#?u|Ak#qv#OcLOoHiBcGwD_IoHiCkAoCOmFN_DjAyBhBaBhC}JpR??gToS_b#}_#oIaHee#{`#k_#c[eo#se#ce#q\\iHsEgh#q\\}m#__#_i#uY_IeEyWgNav#}_#cjAum#s~#sf#{[eOc[kLiMeE{JwCgTsFmd#oIuwAkVwiHqoAux#wNgh#oIuYuEqMiBuJ{AyLyB}JyB_SeEmPeEuSsFka#{Lse#wMsPeFcLwCqjAm^ey#mUuiD{_Akp#aReTaGoSuE{[sGm_#uDku#sFyL}#eJ{#eJkAgJkA{J{BwIgCyGyBoNcGaNaHkd#iWgT{KyQ}JmUkKwX{KmqBcp#a_B}h#cVaIab#wMiRcGg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route. Maybe there is a different way to get those points. I was trying to google it for few days but without any bigger results ;/
The shapePoints string that you are seeing is actually a compressed format, so it is showing the shapePoints, but just not in a regular, readable raw format. The Android Maps API uses the MapQuest Directions Web Service for routing functions. The default routeResponse format in the Android API is cmp6, which is the compressed format that you are seeing, because it is generally more efficient to use the compressed format in an application.
You can tell the Directions Web Service to send the response back in a raw format by setting the shapeFormat parameter, which is included in the Directions Web Service documentation under the Advanced Routing Options section. Check out the Android Maps API Reference Guide for more specific information about setting the route options from within the Android Maps API -- look for the setOptions method on this page.
Also, just want to add that there is a Android Maps API forum on the MapQuest Developer Network and it is also a good resource to check when you have questions about the Android or other MapQuest APIs, like Flash, iOS, etc.
Please don't hesitate to ask if you need more assistance!