Here.com api, getMapPackageAtGeoCoordinates for multiple coordinates - here-api

getMapPackageAtGeoCoordinates: take only 1 value as parameter.
I've a long list of NMAGeoCoordinates and I'm looking for a way to get the "packageId" without doing multiple calls (or using a bounding box as parameter)
UPDATE
My iOS app has a list of routes (hundreds of them) and each route has multiple intermediate points.
For each route should be possible to download the map data offline.
I'm using this api:
https://developer.here.com/documentation/ios-premium/dev_guide/topics/maps-offline-maploader.html
I'm not using the other method based on NMAMapDataPrefetcher because I need to have control over packages installed.
So given a list of NMAGeoCoordinates I need to get a list of possible NMAMapPackage to download.
I can't use the start or destination coordinate because each route can include multiple countries.
I can't call getMapPackageAtGeoCoordinates multiple times to get a complete list of possible countries included in a route (it's to many calls, on the order of tens for each route)
So I'm wondering if there a better way to solve this problem, maybe using a bounding box to get all the NMAMapPackage included in a route.
I've also checked the REST api:
https://developer.here.com/documentation/routing/topics/resource-calculate-route.html
looks like there a way to calculate a route and get a summary of country traversed, usign the RouteAttributeType "summaryByCountry". The response include a field "country" using an ISO 3166-1-alpha-3 format, but there no way to convert this value to an NMAMapPackage id.

There is no other way except you describe to receive NMAMapPackage using geoCoordinates.
This is the only way to use bounding box to download area he needs without multiple invocations.
#interface NMAGeoBoundingBox : NSObject<NSCoding>
+ (nullable instancetype)geoBoundingBoxContainingGeoCoordinates:(nonnull NSArray<NMAGeoCoordinates *> *)coordinates
#interface NMAMapDataPrefetcher : NSObject
- (NSInteger)fetchMapDataForBoundingBox:(nonnull NMAGeoBoundingBox *)boundingBox
error:(NMAPrefetchRequestError *_Nullable)error
NS_SWIFT_NAME(fetchMapDataForBoundingBox(_:error:));

Related

Can VNImageRequestHandler accepts MLMultiArray as an input? (Without converting to UIImage)

I have two MLModels in my app. The first one is generating an MLMultiArray output which is meant to be used as the second model input.
As I'm trying to make things as performance-best as possible. I was thinking about using VNImageRequestHandler to feed it with the first model output (MLMultiArray) and use Vision resize and rectOfIntersent to avoid converting the first input to an image, crop features, to avoid the need to convert the first output to image, do everything manually and use the regular image initializer.
Something like that:
let request = VNCoreMLRequest(model: mlModel) { (request, error) in
// handle logic?
}
request.regionOfInterest = // my region
let handler = VNImageRequestHandler(multiArray: myFirstModelOutputMultiArray)
Or I have to go through back and forth conversions? Trying to reduce processing delays.
Vision uses images (hence the name ;-) ). If you don't want to use images, you need to use the Core ML API directly.
If the output from the first model really is an image, it's easiest to change that model's output type to an image so that you get a CVPixelBuffer instead of an MLMultiArray. Then you can directly pass this CVPixelBuffer into the next model using Vision.

Problems with Graphhopper application

I am trying to make an map with Graphhopper but after I choose and load the map completely on the screen, there are some problems, you can see in the pictures below:
When the map loaded
When I hold tap on the screen for routing
Why did this happen? and how to fix it?
Hard to figure out without logs, but i encountered a similar problem recently.
If you're in the same situation as i was :
This means that your berlin-gh folder does not contain the data relative to the EncodingManager your are trying to use.
First it is important to know which kind of EncodingManager you are using, they can be either of the following :
"foot","car","bike","bike2",etc...
Now let's say you want to get the foot path from one point to another on your map, then you must be building somewhere in your code your graph request :
GHRequest yourRequest(latitudeStart, longitudeStart, latitudeEnd, longitudeEnd);
yourRequest.setVehicle(EncodingManager.FOOT); // or .CAR, .LOL (lol)
These data are constructed by the graphhopper.sh script when you import the map of your choice :
edit the config.properties file inside the graphhopper folder
Vehicles #####
Possible options: car,foot,bike,bike2,mtb,racingbike,motorcycle (comma separated)
bike2 takes elevation data into account (like up-hill is slower than down-hill)
and requires enabling graph.elevation.provider below
graph.flagEncoders=foot
^ Put here your comma separated list of vehicle you want to support
now delete any folder created by graphhopper with previous attempts of import (otherwise the command below will fail)
then launch graphhopper.sh import "your map path"
At this point it should have created the (let's say) berlin-gh folder with the support for the vehicle you chose.
Put this folder in your application (wherever you load it) and now you can configure your graphrequest to load paths for the encodingmanager of your choice.
Hope i'm clear enough.

Extracting Requirements folder Tree structure from QC using API

I am trying to extract requirements from QC Requirement module. i could extract all requirements of a QC project but i would like to extract selected requirements only. So i need to give folder path and extract requirements accordingly.
Currently i use ReqFactory to extract Reqs from QC. Could you please help me or give me idea to extract requirmeents from selected folder path.
I tried Req Path and father id, but still it does not fulfill my need as some may have multiple sub folders under parent folders.
I assume you like to get all the child requirements of a requirement using the OTA API? The only solution I can offer is a bit clumsy. First you have to get the requirement where you want to start, e.g. "Requirements\Projects\ProjectX". How to achieve that is described in the OTA API Reference as an example of the ReqFactory object ("Find a specified requirement in a specified folder"). Or it is posted in this forum. If you know the ID of the start-requirement you can simply get the requirement with req_factory.Item(id).
When you have your requirement where you want to start, you can use the Find-method of the ReqFactory to get all its children, resp. all Requirement objects starting with the same path as the start-requirement. Here is an example-method in Ruby:
def list_all_child_requirements(start_req)
req_factory = #tdc.ReqFactory
req_path_strange_format = start_req.Field("RQ_REQ_PATH")
child_req_list = req_factory.Find(start_req.ID, "RQ_REQ_PATH", req_path_strange_format, 8)
child_req_list.each do |list_req|
puts list_req
end
end
The req_path_strange_format contains a String in the strange Quality Center notation like "AAAAAB". The Find-method starts from the start-requirement and searches all requirements which path starts with the same path as the path of the start-requirement. The parameter 8 means "starts with pattern" (described in the API Reference, Enum tagTDAPI_REQMODE). I just don't know how to access the Enum using Ruby, thats why the magic 8 is used... The Find-method returns a list with format "ID,NAME". From there it should be no problem to extract the requirements.
Doing the same directly in QC with a VAPI-XP-TEST and VB looks like that:
TDOutput.Clear
Dim reqPathStrangeFormat
Set reqF = tdConnection.ReqFactory
Set startReq = reqF.Item(14) ' ID of parent requirement
reqPathStrangeFormat = startReq.Field("RQ_REQ_PATH")
TDOutput.Print reqPathStrangeFormat
Set childReqList = reqF.Find(startReq.ID, "RQ_REQ_PATH", reqPathStrangeFormat, TDREQMODE_FIND_START_WITH)
For Each childReq in childReqList
TDOutput.Print childReq
Next
This code first prints some strange string "AAAAAB" or something similiar, then a list with "ID,NAME" of the requirements.

Yahoo Pipes - Build an RSS-URL using specific parameters pulled from another RSS feed's content

The main Data Type used by Yahoo Pipes is the [Item], which is RSS feed content. I want to take an RSS's content or sub-element, make it into [Text] (or a number might work), and then use it as an INPUT into a [Module] to build a RSS-URL with specific parameters. I will then use the new RSS-URL to pull more content.
Could possibly use the [URL Builder Module] or some work-around.
The key here is using "dynamic" data from an RSS feed (not user input, or a static data), and getting that data into a Data Type that is compatible (and/or accessible) as an INPUT into a module.
It seems like a vital functionality, but I cannot figure it out. I have tried many, many work-around attempts, with no success.
The Specific API and Methods (if you are interested)
Using the LastFM API.
1st Method: user.getWeeklyChartList. Then pick the "from" (start) and "to" (end) Unix timestamps from 1 year-ago-today.
2nd Method: user.getWeeklyAlbumChart using those specific (and "dynamic") timestamps to pull my top albums for that week.
tl;dr. Build an RSS-URL using specific parameters from another RSS feed's content.
I think I may have figured it out. I doubt it is the best way, but it works. The problem was the module I needed to use didn't have and input node. But the Loop module has an input node, so if I embed the URL builder into the Loop module I can then access sub-element content from the 1st feed to use as parameters to build the URL for the 2nd feed! Then I can just scrap all the extra stuff generated by the Loop, by using Truncate.

Nested REST Routing

Simple situation: I have a server with thousands of pictures on it. I want to create a restful business layer which will allow me to add tags (categories) to each picture. That's simple. I also want to get lists of pictures that match a single tag. That's simple too. But now I also want to create a method that accepts a list of tags and which will return only pictures that match all these tags. That's a bit more complex, but I can still do that.
The problem is this, however. Say, my rest service is at pictures.example.com, I want to be able to make the following calls:
pictures.example.com/Image/{ID} - Should return a specific image
pictures.example.com/Images - Should return a list of image IDs.
pictures.example.com/Images/{TAG} - Should return a list of image IDs with this tag.
pictures.example.com/Images/{TAG}/{TAG} - Should return a list of image IDs with these tags.
pictures.example.com/Images/{TAG}/{TAG}/{TAG} - Should return a list of image IDs with these tags.
pictures.example.com/Images/{TAG}/{TAG}/{TAG}/{TAG}/{TAG} - Should return a list of image IDs with these tags.
etcetera...
So, how do I set up a RESTful web service projects that will allow me to nest tags like this and still be able to read them all? Without any limitations for the number of tags, although the URL length would be a limit. I might want to have up to 30 tags in a selection and I don't want to set up 30 different routing thingies to get it to work. I want one routing thingie that could technically allow unlimited tags.
Yes, I know there could be other ways to send such a list back and forth. Better even, but I want to know if this is possible. And if it's easy to create. So the URL cannot be different from above examples.
Must be simple, I think. Just can't come up with a good solution...
The URL structure you choose should be based on whatever is easy to implement with your web framework. I would expect something like:
http://pictures.example.com/images?tags=tag1,tag2,tag3,tag4
Is going to be much easier to handle on the server, and I can see no advantage to the path segment approach that you are having trouble with.
I assume you can figure out how to actually write the SQL or filesystem query to filter by multiple tags. In CherryPy, for example, hooking that up to a URL is as simple as:
class Images:
#cherrypy.tools.json_out()
def index(self):
return [cherrypy.url("/images/" + x.id)
for x in mylib.images()]
index.exposed = True
#cherrypy.tools.json_out()
def default(self, *tags):
return [cherrypy.url("/images/" + x.id)
for x in mylib.images(*tags)]
default.exposed = True
...where the *tags argument is a tuple of all the /{TAG} path segments the client sends. Other web frameworks will have similar options.

Resources