Anylogic - placing resources on GIS map - dictionary

I have a GIS map on main and I have a population of Suppliers on main. Each Supplier has it's own fleet of delivery vehicles which are modelled as a ResourcePool of type DeliveryTruck inside the Supplier agent. I am able to place the Suppliers on the GIS map at the correct locations as defined by longitude and latitude.
In the Properties of the DeliveryTruck ResourcePool I call unit.setLocation(this) in the "On new unit" action however when I query the location of the DeliveryTrucks (getLongitude(), getLatitude()) the DeliveryTrucks are at 0,0 rather than the long/lat of the Supplier they belong to.
Even after I move the trucks to a location on the GIS map using moveTo(longitude, latitude) and query the trucks location on arrival, it still returns 0,0.
I'm guessing it has something to do with making sure the trucks are in the GISMap environment on main but as the ResourcePool for the DeliveryTrucks is within the Supplier it is not obvious how I get them into the GIS map on main.
Any ideas?

Related

Select an object from a collection in anylogic?

I need to simulate an earthquake on my GIS map. I've created some regions on my GIS map and I've created a collection in which put these regions. Now, I need to create a function which choose one of these regions (which may a probability for each one) and in this choosen region model have to locate eartquake epicenter (I created an agent called earthquake).
1- How can I type this code in my body function?
2- Which type of collection do I need to choose (e.g. "Linked List", "Tree map". etc.) ?
3- How can I create after this, earthquake latitude and longitude (I need to send Tir agent on epicenter) ?
I upload below pics to make understandable.
enter image description here
enter image description here
Spontaneous idea:
I would work with an array list, each line is a region as a string.
Then use another variable to find out which region you need (e.g. use a normal distribution, if the value is above a threshold it is region B, otherwise it is A).
As region A and B are in different lines of the collection, your i for the following code changes: collection.get(i);.

Here Fleet Telematics admin area

I am using fleet telematics and accessing tile for kuwait. If a place is present into two tiles I combine combine all coordinates from all rows for that place and convert that coordinates into polygon.
Please see the image below as i see weird polygons.
To get the city bounds of Kuwait city admin area, you may want to use ADMIN_POLY_8.
If you query that layer, you will notice that the ADMIN_LEVEL attribute here is '4' which corresponds to city.
To understand which layer to pick, check the description of the layer on sending this call
https://s.fleet.ls.hereapi.com/1/doc/layer.json?layer=ADMIN_POLY_8&apiKey={{RESTapiKey}}
In the response, you will see the attribute 'ADMIN_LEVEL' which says 'Administrative level 1 - 9.To look up the country specific name/meaning, applications can load the static table {COUNTRY} and fetch the value from column'
When you query the static layer 'COUNTRY' , you will see that 'ADMIN_LEVEL_DESCRIPTION_4' corresponds to city.
This is how you can find out which layer to choose.
you have selected ADMIN_POLY_9 which has places with ADMIN_LEVEL 5.
This gives you the geometric bounds of SETTLEMENT within the city and thus the multiple polygons.

How to get a geoID for the Google Analytics Measurement Protocol from a zipcode or coords?

is it possible to get a geoID for the Geographical Override parameter in the Google Analytics Measurement Protocol from a zipcode or coordinates?
Geographical Override The geographical location of the user. The geographical ID should be a two letter country code or a criteria ID representing a city or region (see Geographical IDs). This parameter takes precedent over any location derived from IP address, including the IP Override parameter. An invalid code will result in geographical dimensions to be set to '(not set)'.
You will need to download the file found at Geographical IDs and then parse it against some kind of world wide zip code list in order to parse your zipcodes into Geoiids.
Sending a zip code to Google analytics isnt going to work it must be a valid GeoId
format of Googles CSV File
The file from google is a CSV with the following columns Criteria ID,Name,Canonical Name,Parent ID,Country Code,Target Type,Status
"1014315","Sunnyvale","Sunnyvale,California,United States","21137","US","City",Active
Geoid 1014315
city Sunnyvale
Cononical name Sunnyvale,California,United States
parent id 21137 (i beleave this is state id in the case of the usa)
country code US
Active
Note: small towns and villages will probably not be listed. You will have to try to find something as close as you can get

How to covert HERE incidents RDS-TMC data to geometries (points)

I'm using the HERE traffic API such as:
http://traffic.cit.api.here.com/traffic/6.0/incidents.xml?bbox=43.8,-79.5;43.6,-79.4&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg&status=active&maxresults=50
The XML returns:
...
<RDS-TMC>
<ORIGIN>
<EBU_COUNTRY_CODE>C</EBU_COUNTRY_CODE>
<TABLE_ID>9</TABLE_ID>
<LOCATION_ID>04184</LOCATION_ID>
<LOCATION_DESC>DUFFERIN ST/EXIT 364</LOCATION_DESC>
<RDS_DIRECTION>-</RDS_DIRECTION>
</ORIGIN>
<TO>
<EBU_COUNTRY_CODE>C</EBU_COUNTRY_CODE>
<TABLE_ID>9</TABLE_ID>
<LOCATION_ID>04187</LOCATION_ID>
<LOCATION_DESC>HWY-11A/AVENUE RD/EXIT 367</LOCATION_DESC>
<RDS_DIRECTION>-</RDS_DIRECTION>
</TO>
<DIRECTION>+</DIRECTION>
<ALERTC>
<TRAFFIC_CODE>701</TRAFFIC_CODE>
<QUANTIFIERS>0</QUANTIFIERS>
<DESCRIPTION>(Q) (--//set of//sets of) roadwork</DESCRIPTION>
<ALERTC_DURATION>L</ALERTC_DURATION>
<ALERTC_DIRECTION>1</ALERTC_DIRECTION>
<UPDATE_CLASS>11</UPDATE_CLASS>
<PHRASE_CODE>E1</PHRASE_CODE>
<EXTENT>3</EXTENT>
<DURATION>0</DURATION>
</ALERTC>
</RDS-TMC>
...
Is there any API to turn the RDS-TMC section information to geometries (points):
Maybe something like this for example:
<Path><Point lat,long /><Point lat,long />[snip]<Point lat,long /><Point lat,long /></Path>
Anything that returns the road geometry (lat, long) will do. Thanks for your assistance.
Could you use the latitude and longitude elements within the geoloc/origin ? Maybe store these in a look up table? I know not all elements are always present, so you may need to use Street Intersection Gecoding in the Geocoding API as well. Street geometry is available from the Enterprise Routing API
I’m not aware of an API that does exactly what you want (then again, I’m not too familiar with HERE services, so there may be something I’ve missed).
The XML you are posting looks like a decoded TMC message, with the <origin> and <to> elements describing the start and end of the affected route. To work even over low-bandwidth connections such as RDS, TMC just transmits 16-bit location codes and relies on lookup tables in the receiver for all the rest; HERE seems to be doing some of that work for you by resolving the description for eqach location.
Three elements in each of these uniquely identify the location: <ebu_country_code> and <table_id> identify the location table, and <location_id> identyfies a unique location within that table. You could decode this into coordinates by obtaining the location table (rather, one location table for each area you want to cover). These will give you one point each for <origin> and <to>. For longer stretches of road, where there are additional TMC locations between these two points, you could walk through the table and obtain these as well (on highways, there is usually al location for each junction and each rest area). However, it would still not give you a complete road geometry—you would need to use map data for that.
A list of sources for TMC location datasets (not exhaustive, though) is here.

Google map api v3 markers exclude a city or certain bound

I am using google maps api v3. I have a database of markers with lat and long address that I display on a map and that works fine.
The map is displaying markers for entire state and now I want to know how can exclude markers in a certain city? Say I am displaying a map of Indiana and want to exclude Indianapolis.
I have a rough idea where I can select the points and some how check if they are between a certain range but could someone elaborate on this with a more specific example or is there a better approach to this?
What you need is something called Reverse Geocoding, which will give you result of street name, city name and country name, given longitude latitude example.
I will do these steps :
Iterate all the marker and "reverse geocoding" the marker lat-long.
Check city result of the "reverse geocoding".
If the City is not inside your accepted cities, remove the marker.

Resources