Easiest way to display location? - ip-geolocation

What is the most up to date, accurate, turn-key code to inject into a page to automatically read a user's IP and spit out their city... on this page we are borrowing from goingtorain.com I want it to display ... within 3 miles of (dynamic city)
http://www.drillavailable.neighborrow.com/

Another one we've been looking at to use is http://www.maxmind.com/app/geolitecity. Looks to be fairly simple to setup and is open source/free with apis for most popular languages.
Not done much other than play with it for 5 mins but looks promising.

I'd go with location aware browsing. Look into the W3C GeoLocation API.
For example, try Google Gears Geolocation module.
These technologies allow your clients to be geolocalized not only by looking and their IP (which can have 200km offsets) but also by triangulating SSID information from nearby wireless Access Points, and this can be extremely precise.
Once you have the (lon,lat) coordinates, it's just a matter of calling some webservice to get the nearest city's name.

I would choose the locator API at http://ipinfodb.com You can access it via XML or JSON, send it your API key and an IP and it will return the city, state, zip, country, etc. You can then parse the results in your language of choice. Its the simplest way to achieve this without actually storing any information about IP/location routing.

Yes, you only need to use the ClientLocation object in the google.loader namespace. In total the whole code is.
<script src="http://www.google.com/jsapi" language="javascript"></script>
<script language="javascript">
if (google.loader.ClientLocation != null) {
alert(google.loader.ClientLocation.address.city);
} else {
alert("Not found");
}
</script>
The properties available are
google.loader.ClientLocation.latitude
google.loader.ClientLocation.longitude
google.loader.ClientLocation.address.city
google.loader.ClientLocation.address.country
google.loader.ClientLocation.address.country_code
google.loader.ClientLocation.address.region

Related

How to access View Template Properties for Revit and compare them in Real Time?

I am trying to list the view template’s properties so we can compare them with another old template.
For example what model elements are hidden or have overrides in a given template or which Revit links have been hidden or overridden in a given template.
View Template
(https://www.google.com/search?q=view+template+revit&rlz=1C1GGRV_enUS770US770&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjLndrd2cTbAhVESq0KHX1cAPwQ_AUICygC&biw=1536&bih=824#imgrc=Q0v-pV7Nxl4kfM:)
I’m looking to devise a View Template Compare tool and access to the owner and creator of them.
public void ApplyViewTemplateToActiveView()
{
Document doc = this.ActiveUIDocument.Document;
View viewTemplate = (from v in new FilteredElementCollector(doc)
.OfClass(typeof(View))
.Cast<View>()
where v.IsTemplate == true && v.Name == "MyViewTemplate"
select v)
.First();
using (Transaction t = new Transaction(doc,"Set View Template"))
{
t.Start();
doc.ActiveView.ViewTemplateId = viewTemplate.Id;
t.Commit();
}
}
With Revit API you can access with:
GetTemplateParameterIds Method / ViewTemplateId Property
The Revit API exposes almost all the ViewTemplate properties.
For instance this method returns all the Visibility/Graphic Overrides for a specific category:
https://apidocs.co/apps/revit/2019/ed267b82-56be-6e3b-0c6d-4de7df1ed312.htm
The only thing I couldn't get for a ViewTemplate are the "includes", but all the rest seems to be there.
Update:
The list or properties "not included" can be retrieved with GetNonControlledTemplateParameterIds().
Yes, and no.
Yes, I guess you can use Forge Model Derivative API to export RVT file and then build a dashboard around the View Templates data. That's assuming that View Templates data actually gets exported when the model is translated. That data is not attached to any geometry so I would not be surprised if it was skipped. The question here is why? This is like renting a 16-wheel truck to move a duffel bag across the street.
No, if your intention is to directly interact with the RVT model. Forge can view it, but to push anything back or request changes to the model, is not available yet. Then again, I am not even sure that the view template data is available via model derivative exports.
This brings me another alternative. Why not just collect the data using Revit API, the standard way and then push it out to a Database and build on top of that? There is no reason to employ Forge for any of that.
Thanks Jeremy, I had dig into your amazing website and also some solution that Konrad post in the Dynamo Forum about this. In Revit seems pretty achievable, you filter the View that is View Template and then extracts these properties, is it correct?.
I am wondering if someone can point me in the right direction with Forge.
Some amazing guys are developing a BQL https://www.retriever.works/.
BQL(Building Query Language) is a query language for buildings, similar to how SQL is a query language for databases. It is fast and flexible. BQL helps improve efficiency for QA/QC (quality assurance and quality control), and building data extraction without leaving Revit. I am also trying these and I would like to understand if there are some works where I could start with Forge next week about this.

Requirements to do reverse Geocoding in Genexus Smart Devices

I need to make a Reverse Geocoding for my SD app with Genexus X Ev3 U7, to show a location through aa given address in the map within the app. I've struggled for some time figuring out how to make it work with no luck.
I've already read all the documentation, followed the steps to get the API key from google (with Geocoding and Geolocation APIs enabled) and tried different ways with the methods shown in it and i haven't made it work.
Should I consider something else? Does anyone have done this before?
thanks before hand
Yes, there are two methods in Geolocation external object: GetAddress() and GetLocation().
If you are using it on the client-side, then both Android and iOS implementations use the platform's native implementation.
If the code runs on the server-side (C# or Java), then the implementation uses Google's geocoding services. The problem here is that there is no way to provide an API Key, so the number of allowed requests by day may be too low (depending on your usage).
Well, the main problem was that i was capturing the values of the Address Domain Collection variable all wrong.
All i had to do was to declare an &Address variable that read an &Addresses collection variable and to give it to a &Adrs VarChar variable:
For &Address in &Addresses
&Adrs = &Address
Load
EndFor
where &Addresses = GeoLocationAPI.GetAddress(&GeoLocation)
I don't know how i didn't come up with this before.
Thanks everyone :)

iOS Mapkit, identifying "type of business"

I've looked through numerous answers (most were slightly outdated), and I was wondering if Apple had some sort of way to identify the type of business it queried?
From the reference guide, MKMapItem has 5 variables, none of which tell me a place is a "Thai Restaurant" or something like that.
placemark
isCurrentLocation
name
phoneNumber
url
I think its interesting how when you do a MKMapkit query on "thai", it'll give you a list of thai restaurants but thats a one way street and no where later can I take a result from the query on "thai" to verify that it is indeed a "thai" restaurant. More importantly, what I am particularly interested in is if a business is a "Thai" restaurant and a "Bar" as well, I want to be able to do a MKMapKit query on "Bar" OR "Thai" and be able to get both of those tags
I can see a solution of getting the coordinates of a business then using Google Maps API or even Yelp API and doing a search on there to get the "type of business" but that seems extremely cumbersome and inefficient.
Thanks for any advice! One of my first questions so please so easy on me =)
First, take a look with this link : http://www.raywenderlich.com/13160/using-the-google-places-api-with-mapkit
The google API will send back the name, type, location of business location near you.
It's also send icons(via image link) of business location, so you can display it on the map, which can help you which is market, which is coffeeshop...
But the "Thai Restaurant" maybe too detail so google doesn't want to show it.
Sorry about my bad english.
Hope it help.
For that you should use google near by place search or place search api. you can pass thailand as place name and restaurant to type and it will return you all the restaurant in thailand.

Getting Location of Tweets found with Twitter Search API

Whenever I search for tweets using the geocode option, the returned tweets have "null" as their geo property. They are definitely coming from the right place because the location property has a name which is in the correct area, however I want to know what the coordinates of the tweet are so I can place on on a map (specifically Windows Phone).
I've tried a really hacky solution of searching for the location using the geo api, but this seems a really awkward way of doing it and often returns bad results (I want results from Oxford, UK but often the geo search return Oxford, IN for example).
Looking around, it seems Twitter's geolocation is currently broken, but I really need this to work for a presentation on Thursday demonstrating an app we built in a group, and it would really suck if our main feature didn't work.
Twitter's search API is broken. It will not return some information which is available through the regular API.
Once you have found a Tweet, you can try looking it up directly using statuses/show
For example, calling one of my tweets:
https://api.twitter.com/1/statuses/show.xml?id=202471009973051393&include_entities=true
gives
<geo>
<georss:point>51.52505194 -0.132582</georss:point>
</geo>
<coordinates>
<georss:point>51.52505194 -0.132582</georss:point>
</coordinates>

how to get Route directions between two points on a map to draw driving directions?

is there a way to use core location or google or some other api to provide two points on the map and get the resulting set of latitude/longitude pairs for the route?
i have seen in this tutorial Drawing polyines or routes on a MKMapView that how to draw driving direction using core graphics...but in the sample code it has route.csv which has predefined set of longitudes and latitudes.....how do i make pair of longitudes and latitudes so that i can draw driving directions.
Companies invest millions of dollars into developing routing algorithms, so I very much doubt that you'll be able to get it for free anywhere (I'm happy to be wrong, though). For example, the Google Maps JavaScript API supports routing, so I guess you could hack that up. The results wouldn't be fast or pretty, mind you.
If you have a limited use of the directions request (less than a certain amount per day) and always display results on a Google map, you do qualify for the free Google Directions API.
https://developers.google.com/maps/documentation/directions/
Read the license part thoroughly to know the limits. You should easily be able to request a json response that will b easier to parse than an xml one (plus Apple added json parser in iOS).
For example
http://maps.googleapis.com/maps/api/directions/json?origin=Boston,MA&destination=Concord,MA&waypoints=Charlestown,MA|Lexington,MA&sensor=false
If you are over the limit, you should look into their business licenses.
Old question but MTDirectionsKit was recently open sourced and it works great:
MTDirectionsKit
with Google API you can get directions from two points, the only problem is you just can use it once a day if you don't pay.
Search how to get the key API from google, there are a lots of videos on youtube talking about it.
Furthemore, i got a library which hepls you to draw the line between points this one https://github.com/jd-alexander/Google-Directions-Android
After you implemented it in build.gradle(Module:app), implement the library in the class like
public class LocationMapActivity extends AppCompatActivity implements RoutingListener
will appear a error to implemets the methods (obligatory to implement them but It's not necessary to use them).
I just did this:
public void route(){
Routing routing = new Routing.Builder()
.travelMode(/* Travel Mode */)
.withListener(/* Listener that delivers routing results.*/)
.waypoints(/*waypoints*/)
.key(/*api key for quota management*/)
.build();
routing.execute();
}
More info in the link.

Resources