Does "HERE Maps API for JavaScript" fully supports GeoJSON format? - geojson

Does API supports holes in GeoJSON?
I have GeoJSON which is rendered with holes on geojson.io but when I render the same data within H.data.geojson.Reader it is rendered without holes.
I haven't found any information about additional options or so in API Reference and no questions related to this problem here on StackOverflow.
Shall I provide my code and data or someone knows whether holes are supported or not?

Check the example which shows the holes with polygon, also to convert the result geometry into geoJSON object.
oGeoJSON ()Object
To obtain a GeoJSON representation of the given geometry.
See:
GeoJSON spec
Returns:
Type Description
Object A GeoJSON Geometry object representing the given geometry.

Related

Get coordinates of Areas for FML3.0 format using scenekit

I am working on an iOS app, that scans the room and, convert it to a FML3.0 format.
(FML3.0 is particular format for storing houses/design info in JSON).
I am able to get coordinates of walls using Scenkit/Arkit, but not sure how to get coordinates of area/room.
So, my question is:
Is there any way to form poly under "Areas" section in FML 3.0 using the walls array.
If not, how can I get the coordinates via scanning the room. Any documentation related to this will be helpful.
Thanks!

Google Cloud Vision API Object Localization - number of recognized objects

I'm using the following python code to detect License Plates with Cloud Vision API.
response = client.annotate_image({
'image': {'source': {'image_uri': uri}},
'features': [
{'max_results': 1000, 'type_': vision.Feature.Type.TEXT_DETECTION},
{'max_results': 1000, 'type_': vision.Feature.Type.OBJECT_LOCALIZATION},
],
})
lo_annotations = response.localized_object_annotations
for obj in lo_annotations:
print('\n{} (confidence: {})'.format(obj.name, obj.score))
print('Normalized bounding polygon vertices: ')
for vertex in obj.bounding_poly.normalized_vertices:
print(' - ({}, {})'.format(vertex.x, vertex.y))
If i use an image showing more cars, buildings, persons etc. I get about 4-7 objects recognized. The recognized objects are the bigger ones in the scene like "Car", "Car", "Building", "Building", "Person"
If I snip out just one car from this image and do the Object Localization with this new image I get objects like "Car", "Tire", "Tire", "License plate" which is perfect - because the plate gets recogized and listed.
So it seems the Object Localization algorithm picks out some prominent objects from the image and ignores smaller or less prominent objects.
But in my case I need to localize all license plates in the image. Is there a way to get the used Model to list all license plates in the image or more objects than just the most prominent ones?
Otherwise what would then be the right approach to get all plates out of an image - do I have to train a custom model?
Vision API is a pre-trained image detection service provided by Google that could perform basic image detection like detecting of text, objects, etc. hence the observation you have mentioned about the API where it usually detects prominent objects in the image.
What I could suggest is, if the objects in your images usually appear in a specific area in the image (eg. objects appear at the lower half) you can pre-process the image by cropping it using python libraries like PIL and OpenCV before using Vision API to detect license plates. Or detect the objects, get the coordinates per object, use coordinates as input to crop specific objects then use Vision API to detect license plates.
And also as you have mentioned, as an alternative you can always create a custom model to detect license plates if you are not satisfied with the results of Vision API. With a custom model, you have more freedom on how to tweak the model to increase the accuracy to detect license plates.

APIs for returning a geoJSON circle shape file for a post request that contains a lat/long centerpoint

Does anyone have suggestions regarding APIs available (free and paid) for posting a lat/long and the API returning a geoJSON shape file built from the lat/long posted?
For example, if I want to a shapefile of a 50 meter circle, derived from a lat/long 42.38567/-86.26877 CenterPoint, are there APIs that can do that? I have 24,000 locations I need this for, and I would very much like not to hand draw 24K polygons on a map.
I've investigated turf.js and developer.here.com but the documentation has been pretty unclear on what endpoint to post to, to solve this problem.
Most geographical libraries have buffer method, meaning they can do it locally (you don't even need any external API).
E.g. geopandas has buffer(distance, resolution) method - distance controls the radius, and resolution tells how precise the circle has to be. You construct point, call buffer method - get circle (approximated as polygon) as output.
Or you can load these points to a database with geospatial functionality (say, PostgreSQL + PostGIS) and call ST_Buffer method to do the same.

What is the best options for tippecanoe to process line string features?

I have a GeoJSON file with a FeatureCollection (more than 300 000 features) of LineStrings. It is a road traffic records. I need to convert it to the MVT format using Tippecanoe. I'm trying to convert the GeoJSON with this params:
tippecanoe data.geojson -pf -pS -zg --detect-shared-borders -o data.mbtiles -f
Then I uploading it to Mapbox account as a tileset and use to render with Mapbox GL JS. And there is a problem - not all the features are visible. Moreover, if if will reconvert the GeoJSON file - then I will get a different result! So - what is the best options to use with tippecanoe to convert all the features (lineStrings) without oversimplification to use it with Mapbox GL JS?
P.S. One more thing which I noticed is that datasets uploaded with Mapbox Studio and then converted to tileset has some info like this: "This layer contains mostly LineStrings", but with my own tilesets converted with the tippecanoe I see a next message: "* No dominant geometry type*"
-ae will auto-increase the maxzoom if features are still being dropped at that zoom level. But when zoomed out it doesn't always look good depending on the type of features (e.g.: mising cadastre doesn't look good)...

How can I transform the coordinates of a Shapefile?

I am trying to get neighborhood data into my application, and I'm having problems with the data I am using, which I got from here.
This file contains a shapefile that has the neighborhoods of San Francisco. I am running a Ruby on Rails framework, and I'm currently using GeoRuby to parse the shapefile.
The code looks like this:
def self.run_import
shpfile = '/path/to/realtor_neighborhoods/realtor_neighborhoods'
ShpFile.open(shpfile) do |shp|
shp.each do |shape|
# This gets the first (and only) Polygon from each MultiPolygon
polygon = shape.geometry.geometries.first
puts polygon.inspect
end
end
end
The code is able to parse the file, but I am unable to understand the coordinates as interpreted. All of the points have values in the millions, when I would expect coordinates between -180 and 180, for valid latitude and longitude. Take a look at an example point:
<GeoRuby::SimpleFeatures::Point:0x00000104566a08 #srid=4326, #with_z=false, \
#with_m=false, #x=6015402.9999795845, #y=2114960.4999904726, #z=0.0, #m=0.0>,
What is the format of these coordinate values? How can I convert them to values that are meaningful to me? (i.e. latitude/longitude based on the SRID 4326 <=> WGS84 spatial reference system)
Thank you in advance!
The data you have from the shape file is projected geographic data.
From your question it sounds like you would really just prefer to have your data in lat/long. To get that you need to reproject your data. I am not a ruby guy, but a quick web search reveals that georuby does not support reprojection http://georuby.rubyforge.org/, however rgeo does. http://www.daniel-azuma.com/blog/archives/28
If you would like to know more about map projections have a look here.
By the way there is a stackexchange site for GIS (geographic information systems) experts called http://gis.stackexchange.com
I noticed this is still getting a log of views. I ended up struggling with RGeo, but there's another solution. If you are able/willing to do your conversion outside/before you execute your ruby code, check out ogr2ogr.
There are more details in my comment on the bottom here:
How Can I Use (Ruby) RGeo to Transform (Unproject) Coordinates
I came across this question as I wanted to transform points supplied in a Shapefile from OSGB36 British National Grid format to WGS84 format (decimal degrees). I spent a lot of time figuring this out so hopefully this code will prove useful.
This code uses the ffi-ogr gem and requires the GDAL library:
require 'ffi-ogr'
data = OGR.read file_name
new_spatial_ref = OGR.import_sr(4326, 'epsg')
data.layers.each do |layer|
transformer = OGR::CoordinateTransformation.find_transformation(layer.spatial_ref, new_spatial_ref)
layer.features.each do |feature|
geometry = OGR::Tools.cast_geometry(feature.geometry)
geometry.transform(transformer)
# Do something with geometry here
end
end
I had the same problem: wanted to convert projected geodata to Lat/Long values.
The ogr2ogr tool was much easier to use than I expected.
To install:
apt-get install gdal-bin
Get info about your shapefile:
ogrinfo data.shp -al -so
Convert to Lat/Long and JSON:
ogr2ogr -f GeoJSON -t_srs WGS84 data.json data.shp

Resources