Analytical map: how to display data of each region state wise - sapui5

I want to divide the country state wise as per latitude and longitude, plot a circle in each state, and also provide JSON-file accordingly.
I have used the below code:
this.oData = {
regionProperties: [
{
"code": "DE",
"region": "Germany",
"Revenue": 428214.13,
"Cost": 94383.52,
"color": "rgb(92,186,230)",
},
{
"code": "FR",
// ...
},
// ...
]
};
In above code, is it possible to add sub region e.g. my country "code": "IN" sub region like "IN-AP", "IN-KA", etc..?

Related

Autocomplete: Read LAT/LON

Is there an easy way to obtain the geolocation data of an autocomplete reply?
Currently only text is returned in a query. How would one read the GPS coordinates for an entry?
https://autocomplete.search.hereapi.com/v1/autocomplete?apiKey=xxx&q=k%C3%B6ln%20&in=countryCode:DEU&lang=de&limit=20&resultType=city,postalCode
{
"title": "Deutschland, Köln, Anschlussstelle Köln-Messe",
"id": "here:af:street:kXSoQ5Ilp2fEnS-ifyMsXD",
"resultType": "street",
"address": {
"label": "Anschlussstelle Köln-Messe, 50679 Köln, Deutschland",
"countryCode": "DEU",
"countryName": "Deutschland",
"stateCode": "NW",
"state": "Nordrhein-Westfalen",
"countyCode": "K",
"county": "Köln",
"city": "Köln",
"street": "Anschlussstelle Köln-Messe",
"postalCode": "50679"
},
"highlights": {
"title": [
{
"start": 35,
"end": 39
}
],
"address": {
"label": [
{
"start": 16,
"end": 20
}
],
"street": [
{
"start": 16,
"end": 20
}
]
}
}
},
The idea of autocomplete is to provide key-by-key input completion for the end user. We believe the end user can decide based on the text response and does not need to show the position on the map. Only for the result that the user clicks on a lookup needs to be requested from the application which then shows the complete address including position.
So to get the geolocation, you need to use lookup endpoint while the user clicks, e.g: https://lookup.search.hereapi.com/v1/lookup?id=here:af:street:kXSoQ5Ilp2fEnS-ifyMsXD&apiKey={{YOUR_API_KEY}}
In addition, you can evalaute the autosuggestion endpoint (which contains the position info) and see if it can meet your requirement: https://developer.here.com/documentation/geocoding-search-api/dev_guide/topics/endpoint-autosuggest-brief.html

OpenStreetMap distances between source and destination(s)

I'm trying to get the distances between one source point and one or more destination points, I'm using the OSRM API to accomplish this. However, the distances being returned are way off.
Source coordinates:
-2.2314725 | 53.4832925
Destination
-2.2315072 | 53.483238
Performing the following request:
http://router.project-osrm.org/table/v1/driving/-2.2314725,53.4832925;-2.2315072,53.483238?sources=0
The distance between the two points should be around 41km, but the result doesn't match at all.
Am I missing something blatantly obvious?
Below is the output from the above request:
{
"durations": [
[
0,
1.3
]
],
"destinations": [
{
"hint": "DBhtiw0YbYteAAAASwAAAAwAAAARAAAAQMh8QZccSEFqRAFARVYzQF4AAABLAAAADAAAABEAAABqpgAAg_Pd_0MXMANP893_HRcwAwEAXxOHnFES",
"distance": 5.459720867300434,
"name": "",
"location": [
-2.231421,
53.483331
]
},
{
"hint": "DBhtiw0YbYtRAAAAWAAAAAwAAAARAAAA27FaQUMzakFqRAFARVYzQFEAAABYAAAADAAAABEAAABqpgAAnPPd_zcXMAMt893_5hYwAwEAXxOHnFES",
"distance": 11.644459328154321,
"name": "",
"location": [
-2.231396,
53.483319
]
}
],
"sources": [
{
"hint": "DBhtiw0YbYteAAAASwAAAAwAAAARAAAAQMh8QZccSEFqRAFARVYzQF4AAABLAAAADAAAABEAAABqpgAAg_Pd_0MXMANP893_HRcwAwEAXxOHnFES",
"distance": 5.459720867300434,
"name": "",
"location": [
-2.231421,
53.483331
]
}
],
"code": "Ok"
}
There are two issues:
You probably mixed latitude and longitude. -2.2314725, 53.4832925 is somewhere in the ocean whereas 53.4832925,-2.2314725 is in Manchester. Sorry, I was wrong. OSRM expects lon,lat.
The two locations are almost identical. They are only 7 meters apart.

Query to calculate a percentage of a GEO surface in a radius

I am GeoJSON unfortunately still a bloody beginner. Now I have to solve a problem and understand, unfortunately, no piece of systematics.
Can you please help me and explain how I can use MongoDB to evaluate GEO data for the following case.
We have three areas (for example, countries), these have a value (say base area) now I have a catchment area that covers all three countries in part. How do I get the percentage of each country?
Here is a graphic to visualize the problem:
It is needed here e.g. the areas of A (n), B (n) and C (n).
In the database (mongodb#3.2) I have corresponding document with GEO data. Example:
{
"type": "FeatureCollecton",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
13.6868862,
51.063946
],
[
13.6873401,
51.063999
],
[
13.6883277,
51.0640888
],
...
]
]
},
"properties": {
"name": "Land A",
"qkm": 65.866862
}
},
]
}, ...

How to post data to a mapquest table

I'm trying to post data to a mapquest table and I've done everything according to their API
Here is my json:
{
"tableName": "mqap.jZ3uoAVablablabla_reported_points",
"append": true,
"returnResults": true,
"rows": [
[
{
"mqap_geography": "POINT (-123.3141509 48.4647675)",
"date": "2016-03-13T02:19:09.674Z",
"email": "anna#gmail.com",
"latitude": "48.47542496514236",
"longitude": "-123.37663650512695",
"message": "ss",
"user": "a"
}
]
]
}
Here is a screenshot of the table
And this is the response I get in Postman
{
"failures": [
{
"reason": "Either no latitude/longitude was provided, or the other information was insufficient for geocoding at or near line #0 of input.",
"row": ""
}
],
"append": true,
"returnResults": true,
"totalRows": 1,
"tableName": "mqap.jblablabla_reported_points",
"tableSize": {
"raw": 8192,
"readable": "8 KB"
},
"data": {
"rows": []
},
"failureCount": 1,
"rowCount": 0,
"info": {
"statusCode": 0,
"copyright": {
"text": "© 2015 MapQuest, Inc.",
"imageUrl": "http://api.mqcdn.com/res/mqlogo.gif",
"imageAltText": "© 2015 MapQuest, Inc."
},
"messages": []
}
}
What am I doing wrong?
The geography column should be in the table by default when the table is created: mqap_geography. This column is populated depending on information in other columns depending on their data type: Geography, [Latitude, Longitude], [Street, City, StateProvince, PostalCode, County, Country], and FullAddress. The Latitude, Longitude columns in the table above are type String so they won't populate the Geography column.
Two things I was missing:
The database NEEDS to have a geography object. So I added a latlong Geography object that I didn't end up using.
The format of the JSON should've been the following:
{
"tableName": "mqap.jZ3uoAVablablabla_reported_points",
"append": true,
"returnResults": true,
"rows": [
[
{"name":"user","value":user},
{"name":"email","value":email},
{"name":"date","value":date},
{"name":"message","value":message},
{"name":"latitude","value":latitude},
{"name":"longitude","value"longitude},
{"name":"latlong","value":"POINT(" + parseFloat(longitude) + " " + parseFloat(latitude) +")"}
]
]
}

Can I retrieve house number on mapbox reverse geocoder?

Currently when I would like to retrieve address for coordinates I make following request as an example:
GET http://api.tiles.mapbox.com/v3/examples.map-zr0njcqy/geocode/-114.0701,51.0495.json
I get address information up to the street level but NO house number. Is there way to retrieve it as well? I think it's such an obvious need and cannot think of any problems extracting this date when you already extracted the rest.
{
"attribution": {
"mapbox-places": "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox © OpenStreetMap</a> <a class='mapbox-improve-map' href='https://www.mapbox.com/map-feedback/' target='_blank'>Improve this map</a>"
},
"query": [
-114.0701,
51.0495
],
"results": [
[
{
"id": "street.31973701",
"lat": 51.0476559,
"lon": -114.0703042,
"name": "3 St SW",
"type": "street"
},
{
"bounds": [
-114.36183200000002,
50.84361600000001,
-113.87432100000002,
51.217528999999985
],
"id": "mapbox-places.10008775",
"lat": 51.03095,
"lon": -114.108491,
"name": "Calgary",
"type": "city"
},
{
"bounds": [
-120.00138351899996,
48.99667665000002,
-110.004763853,
60.00042158400004
],
"id": "province.2553712403",
"lat": 54.872006,
"lon": -115.003552,
"name": "Alberta",
"type": "province"
},
{
"bounds": [
-141.00275000000013,
40.043430830999895,
-47.69751888999983,
86.45371111000011
],
"id": "country.1833980151",
"lat": 76.304456,
"lon": -105.801333,
"name": "Canada",
"type": "country"
}
]
]
}
#rbrundritt is correct.
Most mapping applications (Google, Bing, etc) merely interpolate the location when given a street address. They are aware of the starting and ending address on a given block and then make an educated guess as to where the address you are search for is located on that block based on that. They don't actually store the outlines and the addresses of each property.