how to get the latitude or longitude in HTML 5 - api

few month ago i write something to get the latitude or longitude from google API. latter i get the database from drupal for latitude or longitude to most of city in worlds.
but the problem is that the same city name can be found two or more times in a area. like Firozabad in India and bangladesh both. Agra in UP and agar in Rajasthan.
means the confusion in name by user if they found two city by same name they are confused.
i hear that HTML 5 support latitude or longitude of the visiter but i need latitude or longitude where they are born or city they want to use to fill a form.
how i can get the latitude or longtiude from API like google and some other.
the process is that:
user put the location in textbox for getting their latitude or longitude.
for right thing i want to show them all location [if same thing found more then one].
they can choose the right location and after click they can get the lati and langitude.
how i can do this using any API.

If I understood you correctly then here's a Javascript function that returns a list of actual locations based on the address (full or partial) that user has entered:
getLocationsByAddress = function(address, onComplete) {
var geocoder = null;
var locations = [];
var location = null;
geocoder = new GClientGeocoder();
geocoder.getLocations(address, function(response) {
if (!response || response.Status.code != 200) {
if (typeof (onComplete) != 'undefined') {
onComplete([]);
}
} else {
for (var i = 0; i < response.Placemark.length; i++) {
location = response.Placemark[i];
locations[locations.length] = {
address: location.address,
x: location.Point.coordinates[1],
y: location.Point.coordinates[0],
zoom: 14
}
}
if (typeof (onComplete) != 'undefined') {
onComplete(locations);
}
}
});
}
The code uses API version 2 but I think it should be fairly easy to make it work with V3 (please see this API reference for details).
UPDATE
As #Maxym stated the V2 API is considered as deprecated and therefore shouldn't be used any further.
Take a look at this jQuery plugin. It claims to work with both V2 and V3 so you may want to examine the source code in order to find out how they do an it with V3.

I am not sure that it is about HTML 5. You just need to create sort of hints, where user can select which exactly city she means (the way Google does on maps.google.com - you enter "Odessa" and see list of cities with such name). Google has geocoder API but probably it should be used with Google Map (just read license).
So the process is easy: user enters city, you send it to geocoder to get list of cities with such a name and their coordinates. THen you show that list, user selects one and you have its coordinates.
There is documentation how to use Geocoding API v3 in JavaScript, as well as examples. This one show how to get coordinates from address, take into account that they process results[0] only, but you need to iterate over results to get all cities.

Related

ARCore and Sceneform with Geolocation

I have been reading around the documentation and the examples but still cant figure out a way to use ARCore/Sceneform with geolocations. An example would be opening my camera and according to my geo location and other places' geolocation I would render them on the camera if my camera was on the same compass direction as the object.
Can someone point me in the right direction of where I should be looking at and any guidance and is there something I can use from ARCore/Sceneform that would help with that?
ARCore's Geospatial API
With ARCore 1.31 Geospatial API you can obtain geospatial data from Google Earth 3D and Street View images (from Google Maps), to enable your ARCore app for global-scale location-based AR experiences. This data model, taken from billions of images, is provided with Google VPS.
To enable Geospatial API use the following code:
fun configureSession(session: Session) {
session.configure(
session.config.apply {
geospatialMode = Config.GeospatialMode.ENABLED
}
)
}
Then check if an object's TrackingState is TRACKING:
val earth = session?.earth ?: return
if (earth.trackingState != TrackingState.TRACKING) { return }
Now, you're ready to determine a pose of a new anchor:
val altitude = earth.cameraGeospatialPose.altitudeMeters - 1
val qtrnX = 0f; val qtrnY = 0f; val qtrnZ = 0f; val qtrnW = 1f;
earthAnchor = earth.createAnchor(latLng.latitude,
latLng.longitude,
altitude, qtrnX, qtrnY, qtrnZ, qtrnW)
Geospatial supported areas
Before using the Geospatial API, make sure the area you are in is supported.
I think there's nothing Sceneform specific to help you but I have some ideas:
1. The coordinate system is in meters which should help you to make the needed calculations.
2. You could let the user hold the device upright (check it via sensors) and get use the Camera pose to align it with all sensors you want to use like Compass and Geolocation. Position everything relative to this position. You maybe also want to create an Anchor to that position on order to keep everything updated as ARCore's understanding of the world improves.

Can we extract all Visitor ID's from Adobe Analytics using API

I'm looking to determine whether it's possible via visitor API to be able to find out all visitor ID's.
In the code examples below, [your mcorgid here] is your company's marketing cloud organization id. If you do not know this then you need to contact Adobe Client Care to get it.
getMarketingCloudVisitorID - Get the Marketing Cloud Visitor ID (mid= param)
var visitor = Visitor.getInstance("[your mcorgid here]#AdobeOrg")
var mcvid = visitor.getMarketingCloudVisitorID();
getAnalytcisVisitorID - get legacy visitor id (aid= if applicable)
var visitor = Visitor.getInstance("[your mcorgid here]#AdobeOrg")
var aid = visitor.getAnalyticsVisitorID();
getCustomerIDs - get all customer IDs
var visitor = Visitor.getInstance("[your mcorgid here]#AdobeOrg");
var customerIDs = visitor.getCustomerIDs();
s_fid - Fallback ID
There is no built-in method for retrieving this, but you can use AA's s.c_r() cookie reading utility function, or any other cookie reading method you have to look for the s_fid cookie. (sidenote: I do not recommend using DTM's _satellite.readCookie()method. It only looks for cookies on the current page's full (not root) domain, and there is no way to change that. Since AA and most other things usually set on root domain, it makes _satellite.readCookie() unreliable in practice).
var fid = s.c_r('s_fid');
Use Adobe datawarehouse and extract Experience Cloud ID. Assuming you know how to use the API already, here is an easy report to try
report_definition = ReportDefinition(
dimensions="marketingcloudvisitorid",
metrics="visits",
date_from=insertdate,
date_to=insertdate,
source="warehouse"
)

How to find Trello ListId's or CardId's with Trello.NET

I'm trying to find all cards in a specific list using Trello.NET
In the examples given it's clear to to find all list names in a Board, and all Cards in a Board. However if I want to find all Cards in a specific List, as far as I can see I need ListID (can't filter by List Name) by using trello.Lists.WithId()
Knowing the List name, how can I determine what it's ListId is so I can subsequently filter for all Cards in it?
And if I would subsequently like to edit an existing Card, how can I determine the CardId.
Use LINQ and filter in-memory:
// More than one list can have the exact same name, this finds the first:
var list = trello.Lists
.ForBoard(board)
.FirstOrDefault(list => list.Name == "name of the list");
if (list != null)
{
var cards = trello.Cards.ForList(list);
// ...
}
You could use a similar technique to find a card if you know it's name: use trello.Cards.ForBoard or trello.Cards.ForList first, and then filter by name afterwards.
For cards there is another option though: trello.Cards.Search. For example:
var cards = trello.Cards.Search("name of the card");
The search will be performed on the server in this case.

RavenDB faceted search and creating breadcrumbs/filter urls in mvc3

I am using mvc3 and RavenDB. I have a filter menu where users can narrow
their search using faceted search, as described here:
http://ravendb.net/docs/client-api/advanced/faceted-search
I like to have this URL pattern: /filter/{manufacturer}/{resolution}/{zoom}
For example: /filter/canon/6 means list all camera's of manufacturer canon with
a megapixel of 6 (and all zoom ranges).
I have this working but I run into trouble generating URLs. This will only
work if the facet values are safe to use in a URL eg. replace all ampersands,
spaces etc with a dash and lower case everything. This means I end up
with 'ugly' names in my filtermenu links and breadcrumbs.
Is there a way to have a friendly name to display to the user for a facet value?
so I can create urls like this:
Canon USA (12)
6 megapixels (5)
One solution I can think of would be to store the filters as documents
and just search for a facet value to retrieve its displayname.
A filter document can look like this:
var filter = new Filter
{
DisplayName = "Manufacturer" ,
Slug = "manufacturer" ,
Items = new List< FilterItem >
{
new FilterItem() { DisplayName = "Canon USA" , Slug = "canon" } ,
new FilterItem() { DisplayName = "Photo's & more" , Slug = "photos-and-more" }
}
} ;
Andrew,
Yes, that is probably what you want to do. In general, since you control the values, you can control what those will be, but there is no reason to make things hard globally. You can just store the values somewhere and map between them.
It would be easier all around.

How do I convert from a location (address) String to a YGeoPoint in Yahoo Maps API?

I have a list of addresses from a Database for which I'd like to put markers on a Yahoo Map. The addMarker() method on YMap takes a YGeoPoint, which requires a latitude and longitude. However, Yahoo Maps must know how to convert from addresses because drawZoomAndCenter(LocationType,ZoomLevel) can take an address. I could convert by using drawZoomAndCenter() then getCenterLatLon() but is there a better way, which doesn't require a draw?
You can ask the map object to do the geoCoding, and catch the callback:
<script type="text/javascript">
var map = new YMap(document.getElementById('map'));
map.drawZoomAndCenter("Algeria", 17);
map.geoCodeAddress("Cambridge, UK");
YEvent.Capture(map, EventsList.onEndGeoCode, function(geoCode) {
if (geoCode.success)
map.addOverlay(new YMarker(geoCode.GeoPoint));
});
</script>
One thing to beware of -- in this example the drawAndZoom call will itself make a geoCoding request, so you'll get the callback from that too. You might want to filter that out, or set the map's centre based on a GeoPoint.
If you're working with U.S. addresses, you can use geocoder.us, which has APIs.
Also, Google Maps Hacks has a hack, "Hack 62. Find the Latitude and Longitude of a Street Address", for that.