Shape is not returned for some HERE Geocoder API requests - geocoding

I use the following URL to fetch Shape of postal code in Italy:
https://geocoder.ls.hereapi.com/6.2/geocode.json?postalCode=08013&country=Italy&additionaldata=IncludeShapeLevel,postalCode
Actually, this URL works fine for almost all postal (e.g. 08012) codes.
However, there are a few (e.g. 08013) where the location is defined but Shape property is absent:
{"Response":{"MetaInfo":{"Timestamp":"2020-01-29T15:40:52.032+0000"},"View":[{"_type":"SearchResultsViewType","ViewId":0,"Result":[{"Relevance":1.0,"MatchLevel":"postalCode","MatchQuality":{"Country":1.0,"PostalCode":1.0},"Location":{"LocationId":"NT_CWJpjOLnf1bC2mdwnAMVkA","LocationType":"area","DisplayPosition":{"Latitude":40.33425,"Longitude":8.49083},"NavigationPosition":[{"Latitude":40.33425,"Longitude":8.49083}],"MapView":{"TopLeft":{"Latitude":40.4079,"Longitude":8.40124},"BottomRight":{"Latitude":40.26122,"Longitude":8.56773}},"Address":{"Label":"08013, Bosa, Sardegna, Italia","Country":"ITA","State":"Sardegna","County":"OR","City":"Bosa","PostalCode":"08013","AdditionalData":[{"value":"Italia","key":"CountryName"},{"value":"Sardegna","key":"StateName"},{"value":"Oristano","key":"CountyName"}]}}}]}]}}
When I change additionaldata=IncludeShapeLevel,postalCode to city or country it returns Shape but obviously this shape is not of postal code which I need.
The question is whether HERE Geocoder API has some gaps of data or this can be somehow overcame?

For some zone shape level supports additionaldata=IncludeShapeLevel,city/country city or country only because not all the zones have shape attribute.

Related

How to implement Dependent dropdown for postal code and city in drupal8?

We have a form in that we need two postcode and two city. I have created as entity reference field (Taxonomy). Created a taxonomy as with hierarchical order postcode as first level and cities mapped under postcode. I have totally 18k terms in single taxonomy. when i try to access the page i am getting Memory Limit error. In which i need to implement dependent dropdown. based on postcode selection cities need to be populated in city drop down field. Used Heirrchical select module. which is not suppported for large taxonomy. Any help.
You can do it by creating AJAX callback functions on form

Twitter API code to find specific cities

So far I have this code:
with open("real estate data.csv", "a") as myfile:
myfile.write('"{0}",'.format((tweets.user.location).encode('utf8')))
Which can find me the location of users on the Twitter API when they make a Tweet.
However, it returns broad locations such as New York, but what if I wanted to find specific cities or areas, like Times Square, New York instead of all of New York.
The latitude and longitude coordinates are specified under the coordinates field, however those coordinates are only specified in case the user explicitly shared their location while tweeting.
To access it simply use tweet.coordinates, here is an example:
"coordinates":[-97.51087576,35.46500176]
Read more about coordinates in the doc.
This used to be part of the geo field which is deprecated now so it will always be equal to null.
Read more about how geolocation works within the Twitter API here.

Map locations from ASA to powerbi

I have a Stream Analytics job that generates locations latitude and longitude to powerbi. I am trying to create a map on powerbi.com from these locations. I am creating a map diagram and adding latitude and longitude fields to maps latitude and longitude fields. But nothing is generated. It is expecting some Location field as well. What data should I provide there?
Yes. You need something in the Location field (but it can be a timestamp or an ID or anything). That's what decides how many bubbles you have. Then for each bubble it does an average latitude and longitude to determine where to put the bubble.
The location field is to specify a "City" location rather then specifying it giving coordinates. If you provide "London" for instance it will create the shapes at the center of London as defined in the maps provider.
On the Long and Lat side, they have to be in a specific format for PBi to recognize them as map fields.
Take a look at the links below for further info on how to change the data type using the editor.
http://community.powerbi.com/t5/Desktop/How-to-map-latitude-longitude/td-p/2479
http://www.radacad.com/how-to-do-power-bi-mapping-with-latitude-and-longitude-only
Hope this helps.

GeoDjango/PostGIS/Concept: How to connect user entries to shapefile information?

Hi Stackoverflow people,
I am working on an organisation registration, in which orgs can register their project areas (like all Nevada, entire US, or simply a city e.g. Boston) and users should find all organisations which are covered by the organisation according to their lat & lng.
What is the best way to connect the organisation information with the user searches?
Is the following process ok or do you have any suggestions:
I load the shapefiles of all necessary states, counties , etc. in
my postgis database
If an organisation adds "New York state" to
their coverage area, I would look up the polygon shape for the state
(or the id to the shape) and save it in my coverage table
When I search for the org coverage, I would find all projects where the
user lat & lng is part of
Is that process above ok to connect the user information to the shapefile information?
How can I look up polygons in the shape files? Can I reference them with an ID?
How would the lookup work with cities, since most lists with city name, lat, lng only list the center point of the city? Or is there a table for even city boundaries?
Thank you for your help and suggestions!
When you import a shp file to postgis with shp2pgsql, all the other columns (state name, city name, etc) are imported too, so you can search by name or any other property that the shp file has, or you can search by geometry, if you have a point and you want to search polygons or points(citys in your case) near that point, the query to the database is very simple:
SELECT * from myTable where ST_DWithin(users_point, the_geom, 0.002);
//the distance units of ST_DWithin are in the geometry units.
PS shp2pgsql automatically creates a serial column(unique id)

How to find if lat/long falls in an area using Django and geopy

I'm trying to create a Django app that would take an inputted address and return a list of political races that person would vote in. I have maps of all the districts (PDFs). And I know that I can use geopy to convert an inputted address into coordinates. How do I define the voter districts in Django so that I can run a query to see what districts those coordinates fall in?
This is a non-trivial problem too large in scope to answer in specific detail here. In short, you'll need to use GeoDjango (part of contrib). There is a section dedicated to importing spatial data.
Once you have your data loaded, you can use spatial lookups to find what district a particular coordinate intersects.
As to where to get the voter district data, you might start with www.data.gov's geodata catalog.