Rendering text that is a list with Reactjs - css

My test from api:
"-
Flight for two with a certified flight instructor -
Approximately 1.5 hours of airtime in a Socata TB-10 Tobago -
Opportunity for one passenger to control the plane during part of flight; no experience necessary -
Learn about the flight plan, instrumentation, and basic aircraft control during preflight instruction -
Epic photo ops above spectacular natural scenery and world-famous sites -
Aerial views of downtown LA, the Hollywood sign, film studios, Griffith Observatory, Beverly Hills, Dodger Stadium, the coast, and more "
I want to render this as a list with Reactjs. I have tried the css white-space property with no luck:
-
Flight for two with a certified flight instructor
-
Approximately 1.5 hours of airtime in a Socata TB-10 Tobago
-
Opportunity for one passenger to control the plane during part of flight; no experience necessary
-
Learn about the flight plan, instrumentation, and basic aircraft control during preflight instruction
-
Epic photo ops above spectacular natural scenery and world-famous sites
-
Aerial views of downtown LA, the Hollywood sign, film studios, Griffith Observatory, Beverly Hills, Dodger Stadium, the coast, and more
Thoughts?

I think that's what are you looking for:
class App extends React.Component {
getList = () => {
let apiData = `-
Flight for two with a certified flight instructor -
Approximately 1.5 hours of airtime in a Socata TB-10 Tobago -
Opportunity for one passenger to control the plane during part of flight; no experience necessary -
Learn about the flight plan, instrumentation, and basic aircraft control during preflight instruction -
Epic photo ops above spectacular natural scenery and world-famous sites -
Aerial views of downtown LA, the Hollywood sign, film studios, Griffith Observatory, Beverly Hills, Dodger Stadium, the coast, and more `;
return apiData.split("\n").map(item => <li> {item} </li>);
};
render() {
return <div className="App">{this.getList()}</div>;
}
}
DEMO

Related

Can't webscrape with R the site of Fitch Ratings

I'm trying to scrape the website of Fitch Ratings and until now I can't get what I wanted: the list of ratings. When I scrape with R it returns the header of the website and in the body it gets an "iframe" from googleTagManager the "hide" the content that matters.
website: https://www.fitchratings.com/site/search?content=research&filter=RESEARCH%20LANGUAGE%5EPortuguese%2BGEOGRAPHY%5EAmericas%2BREPORT%20TYPE%5EHeadlines%5ERating%20Action%20Commentary
return:
[1] <head>\n<title>Search - Fitch Ratings</title>\n<!-- headerScripts --><!-- --><meta http-equiv="Content-Type" content="text/html; chars ...
[2] <body id="search-results">\n <div id="privacy-policy-tos-modal-container"></div>\n <!-- Google Tag Manager (noscript) -- ...
_____________
What I want:
Date;Research;Type;Text
04 Sep 2019; Fitch afirma Rating de Qualidade(...);Rating Action Commentary;Fitch Ratings-Sao Paulo - 04 September 2019: A Fitch Ratings Afirmou hoje, o Rating de Qualidade de Gestão de Ivnestimento 'Excelente' (...)
02 Sep 2019; Fitch Eleva Rating (...); Rating Action Commentary; Fitch Ratings - Sao Paulo - 02 September 2019: A Fitch Ratings elevou hoje (...)
Code below
html_of_site <- read_html(url("https://www.fitchratings.com/site/search?content=research&filter=RESEARCH%20LANGUAGE%5EPortuguese%2BGEOGRAPHY%5EAmericas%2BREPORT%20TYPE%5EHeadlines%5ERating%20Action%20Commentary"))
html_of_site
Short Answer: Don't scrape this website.
Long Answer: Technically it is possible to scrape this site, but you need your code to act like a human. What this means is that you would need to convince Fitch Group's server that you are indeed a human visitor and not a bot.
To do this you need to:
Send the same headers that your browser would send to the site
Keep track of any cookies the site sends back to you and return them in subsequent requests if necessary
Evaluate any scripts sent back by the server (to actually load the data you want).
I wasn't able to access the site policy for the thefitchgroup.com, but I assume it includes clauses about what bots are and are not allowed to do on the site. Since this company likely sells the data you are trying to scrape, you should probably avoid scraping this site.
In general, don't scrape sites without reading the site policies first. If the data you are scraping is not free without scraping it, then you probably shouldn't be scraping it.

Google maps API duration_in_traffic with waypoints

I need to get the duration_in_traffic for 3 legs of a journey. I make a call to google directions service with an origin, 2 waypoints, and a destination. Google then returns a JSON object with one route, comprised of 3 legs as expected, but only gives duration, not duration_in_traffic. Without the waypoints it does return the duration_in_traffic. If you include the waypoints and set stopover=false, then it routes the journey via the waypoints, reports the duration_in_traffic but doesn't return the information as separate legs.
I need the separate legs as I need to calculate information for each leg (e.g. fuel usage).
I could split the work into 3 separate calls, but that means incurring 3x the cost and paying Google more for the privilege.
Is there a way of getting duration_in_traffic AND having the results split into legs, using just one call?
This really makes sense, after all my investigation, it looks like we have to make 3 different calls to calculate the traffic duration for each routes. I am having the same issue.
But this could help at some point.
https://maps.googleapis.com/maps/api/directions/json?origin=Edison NJ&destination=Morristown, NJ&waypoints=via:Scotch Plains, NJ|via:Basking Ridge, NJ&departure_time=now&key=YOURKEY
You have to use via: keyword in waypoints to plan your destination using specific points. This returns one leg with total duration in traffic and total miles in the route. This should help you.
This describes, when you want to go to Morristown NJ from Edison NJ, you will be going through Scotch Plains and Basking Ridge waypoints.
{
distance: {
text: "19.2 mi",
value: 30859
},
duration: {
text: "40 mins",
value: 2379
},
duration_in_traffic: {
text: "35 mins",
value: 2120
}
For more info go to
https://developers.google.com/maps/documentation/directions/intro#Waypoints

What are address26 and address29 in Nominatim?

Occasionally - rarely - a Nominatim search will return a hit with a key "address29" or "address26". There is no mention of such a key in osm, and I can't find any explanation in Nominatim.
Here's an example. Search nominatim for bamako (the capital city of Mali). Among others you'll see:
{"place_id":"104544188","licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
"osm_type":"way","osm_id":"197528638","boundingbox":["47.4519905","47.4523668","-0.5565341","-0.5561207"],"lat":"47.4519905","lon":"-0.5565341",
"display_name":"Bamako, Angers, Maine-et-Loire, Pays de la Loire, Metropolitan France, 49000;49100, France",
"class":"highway","type":"platform","importance":0.2,
"address":{"address26":"Bamako","city":"Angers","county":"Angers","state":"Pays de la Loire","country":"France","postcode":"49000;49100","country_code":"fr"},"namedetails":{"name":"Bamako"}},
In the address field/object you see "address26":"Bamako". What does that mean? the other keys all make sense.
If you access the osm id: (eg, http://nominatim.openstreetmap.org/details?osmtype=W&osmid=197528638), there is no mention of address26.
At the website: https://thefive.sabic.uberspace.de/ they have a number of address26 entries pointing to Nominatim. I don't know what their database represents.
I have come across other Nominatim search results with address29 instead of address26.
If you look at http://taginfo.openstreetmap.org/, you won't find address26 or address29 as keys or tags...
Once in a while you will see a city named "fixme" on an osm map, but at least you have an idea of what's going on there, address2[69] stumps me. Does anyone know why?

Nokia HERE maps: Get a list of all places-categories

I need a list of all Categories used by places in nokia HERE maps.
From the documentation I have found these,
eat-drink,
going-out,
sights-museums,
transport,
accommodation,
shopping,
leisure-outdoor,
administrative-areas-buildings,
natural-geographical
But the places returned by RESTful api have much more categories, some of the Categories I found are these,
restaurant, theatre-music-culture, cinema, shop, shopping, accommodation, sights-museums, transport, museum,
landmark-attraction, snacks-fast-food, hotel, food-drink, kiosk-convenience-store, eat-drink, hostel, recreation,
bar-pub, hardware-house-garden-shop, coffee-tea, clothing-accessories-shop, bookshop, dance-night-club, department-store,
going-out, leisure-outdoor, administrative-areas-buildings, natural-geographical
which are not mentioned anywhere in the documentation.
Where do I get a list of all such categories?
A list of categories can be obtained using the categories endpoint.
Example:
http://places.cit.api.here.com/places/v1/categories/places...
See the Places API reference - particularly the resources section for more details. You should also bear in mind the following:
The category graph may change at any point in the future and may be
different depending on the location of the request. Only the subset of
fixed categories can be used as filters. These categories are guaranteed
not to be removed in future releases. At the moment, the
following fixed categories are defined:
eat-drink
going-out
sights-museums
transport
accommodation
shopping
leisure-outdoor
administrative-areas-buildings
natural-geographical
These are the drones you're looking for:
eat-drink:
restaurant
snacks-fast-food
bar-pub
coffee-tea
coffee
tea
going-out:
dance-night-club
cinema
theatre-music-culture
casino
sights-museums:
landmark-attraction
museum
religious-place
transport:
airport
railway-station
public-transport
ferry-terminal
taxi-stand
accommodation:
hotel
motel
hostel
camping
shopping:
kiosk-convenience-store
wine-and-liquor
mall
department-store
food-drink
bookshop
pharmacy
electronics-shop
hardware-house-garden-shop
clothing-accessories-shop
sport-outdoor-shop
shop
business-services:
atm-bank-exchange
police-emergency
ambulance-services
fire-department
police-station
post-office
tourist-information
petrol-station
car-rental
car-dealer-repair
travel-agency
communication-media
business-industry
service
facilities:
hospital-health-care-facility
hospital
government-community-facility
education-facility
library
fair-convention-facility
parking-facility
toilet-rest-area
sports-facility-venue
facility
leisure-outdoor:
recreation
amusement-holiday-park
zoo
administrative-areas-buildings:
administrative-region
city-town-village
outdoor-area-complex
building
street-square
postal-area
natural-geographical:
body-of-water
mountain-hill
undersea-feature
forest-heath-vegetation

Google Maps API Alternative Route Description

I am working with Google Maps API V3 to calculate all the possible routes from a given Source to the specified Destination. For this I takes the Destination and Source as inputs from the user and pass these values in the request with option provideRouteAlternatives: true. I am successful in calculating different Routes and also marking i.e. displaying them on my Map.
Now I am wondering if it is possible to name the Different Routes. By naming the Routes I mean adding a small description to each Route like the Street Name etc. which that particular route takes while moving from Source to Destination. I want to do this so as to make it look more interactive. For example if there are 3 Routes possible from location A (Arizona Street, San Diego, CA, USA) to location B (Fenton Parkway, San Diego, CA 92108, USA) then instead of showing results like Route 1, Route 2, Route 3 it should show the Street names like "Texas St & Rio San Diego Dr", "Texas St & Friar Rd", "Friars Rd".
I am able to calculate all the other things like the trip distance and total trip time for each of my Route but have no clue to how to add this description to each of my Route.
Any help will be appreciated.
Thanks
That is what appears in the panel if you provide one:
Suggested routes:
Texas St and Rio San Diego Dr 2.6 mi - about 9 mins
Texas St and Friars Rd 3.3 mi - about 10 mins
Friars Rd 4.8 mi - about 11 mins
example
Try using summary from the returned result. From the Google Maps API:
summary contains a short textual description for the route, suitable for naming and disambiguating the route from alternatives.

Resources