Good afternon! How can i get a route summary for each country in the route? For example, I want to move from Ukraine to France. I get route from GetRouteDirections, the route runs through 4 countries, and i want to see - how many kilometers this route takes over each of the countries of the route
Currently the Azure Maps routing service does not provide an option to return this information, although it is something being considered as a future feature. I have seen this question in the past with other mapping platforms, and there was nothing out of the box for this in those platforms either.
That said, if you want to achieve this today you can do the following:
Get a set of country boundaries that are suitable for your users (if you have users in countries that have disputed borders, you will likely need several sets of country boundaries).
Calculate a route and use path to create a line.
Calculate the intersection of the line with each country boundary and then measure the length of the section of line that intersects.
I've done this as a proof of concept in the past using a set of GeoJSON country boundaries and the JavaScript topology suite (https://github.com/bjornharrtell/jsts). I haven't posted the code online as country borders are disputed in some regions and thus, any sample I put out there wouldn't work globally.
A global solution could be achieved by retrieving the country boundaries from Azure Maps, but you would need to retrieve the boundaries for all countries first, which would be a bit time consuming and generate a lot of transactions.
Related
I want to find routes using OSRM (Open Source Routing Machine) avoiding a certain area of the city, specified by a polygon, as an option. One approach is to make two profiles: car and car_avoid_no_drive_zone. The latter profile looks up each way segment and sets the length to infinity if it is inside the no drive zone.
But this approach technically duplicates the pre-processing, disk usage and RAM usage. Is there any better solution to this problem?
it is possible to block some area via a "traffic update" by setting 0 speed on all OSM segments on the border of the restricted area and doing only CH contraction or MLD customization. This approach will still generate two graphs. More information here https://github.com/Project-OSRM/osrm-backend/wiki/Traffic
Another way is to use a coming soon "avoid" feature https://github.com/Project-OSRM/osrm-backend/pull/4315 by defining a "restricted area" class in a profile and using a query parameter like avoid=restricted at runtime.
I want to calculate distance between two zip code by bing map API. Is there any possible way to do this I tried this link but this is not for two zip code. Is there any way to do this.
I Pass ZIP1- 34481 and ZIP2- 34705 and want result 70.9 in miles
i calculate this direct from bing map. Thanks for your response
From reading the article, the example as stands will give you a GEOGRAPHY point object (although not sure if your inputs are valid, it seems it require a street address). Anyway, call it twice then to determine the distance between the points returned use something like
Point1.STDistance(Point2)
Here's the BOL reference https://msdn.microsoft.com/en-us/library/bb933808.aspx
Alternatively, see this question for a Bing Routes API answer. How to calculate the driving distance between two points?
If you still need to geocode the approx centre of a zipcode, you might be better off importing the data yourself. I did this recently for the Australian GNAF data (https://www.rednotebluenote.com/2016/04/importing-psma-geocoded-national-address-file-g-naf-to-sql-server/ ) which you might find useful background reading. For US I believe http://census.gov/ makes something similar available.
Hope this is of use.
I have an app that tracks and displays various stats for a local athletic league. One of my requirements is to be able to break down stats by game type, league id and location id. The user picks a value for each of those 3 items and then goes off to view various stats with the 3 variables stored in a session. This works fine, but my problem is that users can't link back to whatever stats they were viewing. I know I can extend the life of the session, but I'd rather pass the state of those 3 variables around in the URL so I can have the ability to link back to any specific stats page with any or none of those 3 variables defined.
Query strings seem like an obvious way to do this, but I can't tell if there's any way for me to 'automatically' append the query string to all links generated in the app, or if I manually need to go through and add the querystring parameters wherever I generate a link or do a redirect. That seems like the brute force approach and I feel like there must be a better way to do this sort of persistence that I'm missing. Any help appreciated!
For a number of reasons (linking, SEO...etc), use a URL, not sessions/cookies. And instead of IDs, use slugs instead:
www.mysite.com/league/football/youth/newyork
I'm sure there are many different ways to keep the url vars consistent across the board, but the way I can think to do it would be the following:
You can use Cake's route functionality to set each item to a variable and make nice looking URLs
In your AppController's beforeFilter(), set the Session of each item (type, league, location)
Make a custom MyHtmlHelper
in it, check if your Session for each contains data, and if it does, append to every link that needs it (could use only for specific controllers, actions...etc)
I hope there's a simpler way, but that's all I could think of offhand.
So I am running into an issue with where i need to divide my users into segments in Apsalar but it's based off of one event
The event only happens when running in debug (so testers), and while i can still make a segment for them in Apsalar i will run into the issue where testers have their events mixed in with players
The end result of this is that tester data and player data are separate and I keep track of both.
I can do this with Flurry because they allow me to segment based on NOT having an event, but I was wondering if there was a way to do something similiar with Apsalar?
To accomplish your goal - separating tester data from player data - I recommend creating a unique application from within the Apsalar dashboard.
Doing so will allow you to divide your events, segments, cohorts, and other application data into two clear buckets on Apsalar's platform. I believe it is better to ensure you are not duplicating the data you are reporting and analyzing in Apsalar than to create an event based on the absence of an event. If you create multiple segments based on NOT having an event, I guarantee it will be difficult to parse which segments belong to your testing and production purposes.
Let me know if this helps.
Image URL:
http://ge.tt/4tJJSJR/v/0
I want to build a database of geographical locations and would like to be able to identify locations that fall inside other locations. For example, The Empire State Building is going to have one geo-coordinate, but my database would be able to tell me that it falls inside Manhattan, which falls inside New York City, which is in the state of New York and so forth.
I've been looking at OpenStreetMap which seems to have a pretty decent database but as best I can tell, I would need to create a set of polygon structures representing each region and then detect if a coordinate falls inside a given region's polygon. Is there a better way to do this, or is there a data source where all of this has already been calculated?
Try the Yahoo! GeoPlanet Data at http://developer.yahoo.com/geo/geoplanet/data/
It is already organised into a hierarchy structure, countries, admin divisions and places.
You can also extend the data by using the 'Geo' methods of the YQL API at http://developer.yahoo.com/yql/console/
You also may want to look into the Geonames database. While it is not classified using hierarchical method, you could probably derive the information out of it.
If you really want to dive into building a geographical database where you can analyze the data, take a look at loading your data into the free/open-source PostgreSQL/PostGIS stack. With that you can actually write SQL that answers questions like "show me all points [within a city/county/state boundary]" or "[within X distance from Y location]".
Good places to learn more about PostGIS is at the BostonGIS website, the GIS.StackExchange pages, or of course the manual but who reads those anymore...
I'm pretty sure the google maps API has regions defined as polygons. And by regions I means, State, City, Zip Code, or just about anything that could be defined as a "region"
You would have to hit-test (Google Maps might have a function for this already) a point to see if it is inside a polygon.
You could also use the lookup address by GeoLocation functions to find which region(s) a point resides in, and just use that.