How can I search street or postal address on simplekml without using coordinates - coordinates

I have a list of street addresses, weekly my database grows. For example 10 Hage Geingob Walvis Bay. I need to plot their positions on Google Mymaps (or alternatively Google Earth) using the kml file. I'm doing it via Python. I'll eventually have control over the labels, colors, titles, descriptions offering me some value.
However the code seems to only respond to coordinate (lat/long) input, using the "coords" command. When using "address" command it simply targets the 0,0 lat/long position in the ocean.
I would appreciate any help on how to use the a street address as the input directly into simplekml...as if I typed the street address directly into google maps or google earth.
As a workaround I have used geocode functions such as geopy and Nominatim ...to establish GPS coordinates and then feed that to simplekml ...but accuracy is terrible. Some addresses are accurate, some are miles off.
I'm not interested in setting up keys and API's in GoogleV3.
Code used as workaround
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="redacted")
location = geolocator.geocode(address)
print(location.address)
print((location.latitude, location.longitude))
import simplekml
kml = simplekml.Kml() # Create an instance of Kml
single_point = kml.newpoint(name=address, coords=[(location.longitude,location.latitude)])
kml.save("10 Hage Geingob.kml")```
When in my view it should be possible to do the following according to the simplkml documentation...
```street_address = '10 Hage Geingob Walvis Bay'
import simplekml
kml = simplekml.Kml()
kml.newpoint(name=street_address, address=street_address)
kml.save("10 Hage Geingob.kml")```
...but it doesn't work. Any help is much appreciated thank you. I am indeed a complete noob.
Thank you

Related

How can I obtain all of the street names under a polygon in Overpass?

I am new to overpass (after only discovering it last night). I have a polygon I drew on QGIS and I plan to obtain its coordinates (long, lat). I'd then like to use these coordinates in overpass to obtain all of the road names in that area. I found a query online that obtains all road names in a city:
[out:csv ("name")][timeout:2500];
{{geocodeArea:Roma}}->.searchArea;
(
way["highway"]["name"](area.searchArea);
);
for (t["name"])
{
make street name=_.val;
out;
}
How can I adjust the following query so that I can specify a polygon function instead of city/area name?. I'm mindful of the syntax:
(poly:"latitude_1 longitude_1 latitude_2 longitude_2 latitude_3 longitude_3 …");
I'm just not sure where it would go in the query. I tried a few times but I was receiving errors or just blank results. Hopefully if I see an example I should be able to carry out my task effectively.
After doing some research I found the answer. This would give me a list of road names:
[out:csv ("name")][timeout:2500];
way["highway"]["name"]
(poly:"51.5566 0.0763 51.5734 0.0724 51.5203 0.0293");
out tags;
And this would give me a map view:
way["highway"]["name"]
(poly:"51.5566 0.0763 51.5734 0.0724 51.5203 0.0293");
out geom;

Why am i getting a difference between matlab's "lla2eci" and "sgp4.propagate"?

I am not experienced in this area but over the past few days I've put together some code in python that tracks (hopefully) the ISS. I've done the math and have that side of things working, but only when I inject the satellite position using matlab's lla2eci. To get a correct answer, I take the latitude and longitude of the satellite's subpoint from live data and convert that to eci using matlab. This method gives me correct look angles (azimuth and elevation) for the ISS, and I've confirmed them with the pyephem method using iss.compute(home) where "home" is my lla.
I'm comparing matlab's lla2eci to what satellite.propagate(...) is getting me and at time = 2019 12 16 8 53 19, i get the following results:
Matlab lla2eci: x,y,z = (3873.9, -902.18, -4969.9)
sgp4 propagate: x,y,z= (-4082.5, 3458.3, -4195.1)
I have to be missing something here! Any help would be greatly appreciated, and I'm glad to answer any questions to clarify.
Looking at the question, seems like you are not taking Altitude into account?
Since your aim is to track the ISS using a python code may I suggest a slightly different approach?
TLE values for space objects are available at: https://www.space-track.org/, so sign-up there.
Then find the position of the satellite in python by using sgp4(https://pypi.org/project/sgp4/) and spacetrack(https://pypi.org/project/spacetrack/) libraries.
An example code would look like this:
from sgp4.earth_gravity import wgs84
from sgp4.io import twoline2rv
from spacetrack import SpaceTrackClient
from datetime import datetime
#generate TLE from database
st = SpaceTrackClient('YOUR_USERNAME', 'YOUR_PASSWORD')
tle = st.tle_latest(norad_cat_id=[<ISS_NORAD_CAT_ID>], ordinal=1, format='tle')
line1 = tle[:69]
line2 = tle[70:-7]
#create satellite object
satellite = twoline2rv(line1, line2, wgs84)
date_time = datetime.utcnow()
#find position
sat_position, sat_velocity = satellite.propagate(date_time.year, date_time.month,...
date_time.day, date_time.hour, date_time.minute, date_time.second)
Use your own username, password and norad ID.
welcome to stackoverflow :)

How can I get a list of bridges with their location (latitude and longitude) from an OSM file?

maybe this query may be a bit trivial or perhaps laborious, but for a project I need to obtain the bridges that exist in an osm file along with its location (latitude and longitude).
Reading the openstreetmap wiki, I see that there is a procedure using osmosis but I do not know if I will actually get the information as follows:
Name of the bridge | latitude | longitude
bin / osmosis.bat --rx brandenburg.osm.bz2 --bp file = "city.poly" --tf accept-ways highway=motorway_link,motorway --way-key-value keyValueList="bridge.yes" --used-node --write-xml brdg_autob.osm
Thanks in advance
Pablo
The output will be OSM XML and not plaintext.
Also, most bridges in OSM are mapped as ways. A way consists of multiple lat/lons represented as nodes. If you need a single lat,lon pair then you have to calculate the bridge center yourself.
Additionally, not all bridges are tagged as bridge=yes. See bridge in the OSM wiki for a list of commonly used tags, such as bridge=viaduct, bridge=aqueduct, bridge=boardwalk and so on.
You won't exactly get the format you described. However with some little work you can transform OSM XML into your format.

Turning off reverse geocoding when opening "Maps" in iPhone through a URL with lat./long. parameter

I am trying to figure out how to use the Google Maps URL format for sharing locations as latitude/longitude in an app that I am developing for iPhone.
Example: http://maps.google.com/maps?q=40.77407,-73.96675
This is a point in Central Park, New York. When using this on an iPhone, "Maps" will open and reverse geocoding will be done, resulting in an address on the nearby 5th Ave.
But for sharing a meeting point in Central Park, this is quite useless!
Is it possible to specify any parameter in the query string that will turn off reverse geocoding, so that the exact lat/long position is shown in the "Maps" app on iPhone?
(Compare with the result one will get when entering this url on a desktop, where the exact location will always be pointed out by a green arrow.)
I found the answer myself: Adding "loc:" immediately after "q=" will turn off the reverse geocoding.
Example: http://maps.google.com/maps?q=loc:40.77407,-73.96675
Instead of a generic 'q', which according to specification is treated like a generic query
This parameter is treated as if it had been typed into the query box by the user on the maps.google.com page. q=* is not supported.
you could try ll or saddr.
ll The latitude and longitude points (in decimal format, comma separated, and in that order) for the map center point.
saddr The latitude and longitude points from which a business search should be performed.
The maps url scheme is specified here: http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/MapLinks.html

latitude/longitude

Is there any way to find out the latitude/longitude of a place using IP address.
ip2location.com has a number of resources (some of which are free) for doing this, including scripts and demo databases - but I'm no iphone expert so I don't know if they're of any use in that particular environment.
I use quite a good free api for that in my PHP projects: http://api.hostip.info/?ip=IPADDRESSTOLOOKUP
returls XML... not sure if this is of use to you! :)
But the iphone is supposed to have an embedded gps chip, so I think you might use it to get this information.
Moreover, I think that with IPV6 you'll be able to use a given IP from multiple locations.
Assuming you're trying to find the position of someone/thing else, then generally no. There are a few exceptions, for when that IP address is registered to an individual business, which in turn list their full address in the whois record. You could then geocode that using a webservice (etc.) to get lat/long.
If you're trying to find out where you are, then you're probably better off using the built in GPS
The IP address doesn't uniquely identify a location.
I know I get a lot of unwanted ads telling me about good times to be had in my location.
The problem is the location is wrong.
I would say that this is a very easy way to do get the latitude and longitude. You can even get it of the user who is visiting your site.
$ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
//$user_location is returning latitude , longitude
$user_location = $details->loc;
//you can split them like this som you get them in two different variables
$pieces = explode(",", $user_location);
$lat = $pieces[0];
$lon = $pieces[1];