Map: Direction in Mapkit to every Countries [duplicate] - ios

My GeoJSON file is supposed to cover the entire world. Here is the GeoJSON file:
{ "type": "MultiPolygon",
"coordinates": [
[[[-169.4,58.8], [-168.0,83.4], [188.4,83.3], [194.0,-72.8], [-166.6,-73.6], [-169.4,58.8]]]
]
}
The name of the file is example.GeoJSON.
I keep getting the following error when uploading the file:
Your routing app coverage file is invalid. For more information see the Developer Guide.
What is wrong with the above file?
My app has a mapkit that shows the annotation of a particular place depending on the place that is chosen. When tapping the map in the app, Apple Maps opens up and shows the directions to that place from the current position. Do I also actually need to upload the .GeoJSON file?

Based on the following:
1) The Latitude goes from -90 into +90 (i.e. this is where you stand on the middle of the globe going either up or down) (AKA vertically).
2) The Longitude goes from 0 to 360 (i.e. standing where you are, and going around the globe in a circle horizontally.
3) The Polygon usually has 4 points, however, in this case it would be 5 whereas the first and last points are the same to denote a closed-polygon.
4) Adding the apple requirements of ( "type": "MultiPolygon" ) plus coordinates,
5) You would end up with the following contents of a file:
{ "type": "MultiPolygon",
"coordinates": [
[[
[-360.0000,-90.0000]
,[-360.0000, 90.0000]
,[-000.0000, 90.0000]
,[-000.0000,-90.0000]
,[-360.0000,-90.0000]
]]
]
}
Therefore, start your text editor, and then copy and paste the above, save the file into World.geojson and then upload.
Mine worked fine.
Enjoy!
Heider

Related

How to Reproject GeoJSON without crs property to WGS84 (to use React Leaflet)

(Please help I've been struggling with the same problem for more than three days...🤖)
I got GeoJSON file from National Statistical Office, which means it's official data- and the coordinates in this file look like this- :
[959394.1770449197,1948599.8772112513],
... ,
[1140386.5164449196,1684523.5489112514],
It's a GeoJSON object without a member named "crs", and as you can see, it's not using the WGS84 datum. Seems like it's coordinates to draw polygons, which are the shape of each district. I assume that there is no problem with data structure.
I tried to create map using this file with React Leaflet, but failed continuously. To find out if it's the problem of GeoJSON that I'm using, I used other GeoJSON files and it worked fine(meaning that interactive map was created on web) - By comparing the GeoJSON files, I found out that coordinates should be in WGS84 if I want to work with leaflet. So I tried to transform GeoJSON to WGS84 using reproject. In my react app project, I installed reproject, epsg and put the code below:
import * as mapData from '../data/sigunguWithPopGeo.json'
import { toWgs84 } from 'reproject'
import 'epsg'
let epsg = require('epsg');
toWgs84(mapData, undefined, epsg);
And the error was returned:
Error: Unable to detect CRS, GeoJSON has no "crs" property.
Thanks for reading this long intro - Finally here is my question.
Is there any way to reproject GeoJSON without "crs" property to WGS84? I also tried making the coordinates WGS84 with mapshaper.org. Again, I got the error caused by undefined coordinate system of GeoJSON file:
Unable to project -- source coordinate system is unknown
Should I consider adding crs property to GeoJSON? It's my very first time to create the interactive map using GeoJSON with React-leaflet, so any kind of advice from people who experienced similar projects would really help me!
Luckily, solved the problem by myself..!
Instead of keep looking for the methods to convert GeoJSON with undefined coordinate system to WGS84, I visited National Statistical Office's website to figure out the code of coordinate system that was used in src data - which was EPSG 5179. Then I converted GeoJSON file from EPSG 5179 to EPSG 4326(WGS84) on MyGeoData Converter. Before downloading the converted data, I checked on the map to see if the coordinates of data was successfully converted to proper lat, lng values. Hope this solution helps who are struggling with similar problems..👩‍🔧

How to set a resource in a firefox addon?

I have basically the same problem as this guy. I have a page, accessed over the web (well, local intranet, if that matters), and it needs to reference images on the client's machine. I know those images are going to be in C:\pics. Internet Explorer lets you just reference them, but I'm having trouble printing properly with internet explorer, so I want to try firefox. The answer on that question says you can create a "resource" with a firefox add-on that pages will be able to reference. However, it doesn't seem to be working. I followed the guide for how to make your first add-on and got the red border to work on mozilla sites. I tried editing that add-on to include a chrome.manifest file that just says this:
resource exposedpics file:///C:/pics
and then the page (an asp page) references exposedpics.
<img align=left border="0" src="resource:///exposedpics/<%=Request("Number")%>.jpg" style="border: 3 solid #<%=bordercolor%>" align="right" WIDTH="110" HEIGHT="110">
the page doesn't show the picture. If I go to View Image Info on the image, I'll see the address is "resource:///exposedpics/8593.jpg" (in my example where I input 8593), but it doesn't show the image here. (yes, the image does exist under c:\pics. if I go to file:///C:/pics/8593.jpg, it loads.)
so maybe I don't know how to use a chrome.manifest. (I'm not sure if I need to reference it somehow in my manifest.json, I'm not.) That stack overflow question also says it's possible to dynamically create resources. so I tried to make my manifest.json say:
{
"manifest_version": 2,
"name": "FirefoxPixExposer",
"version": "1.0",
"description": "allows websites to access C:\\pics",
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["expose.js"]
}
]
}
and expose.js says
// Import Services.jsm unless in a scope where it's already been imported
Components.utils.import("resource://gre/modules/Services.jsm");
var resProt = Services.io.getProtocolHandler("resource")
.QueryInterface(Components.interfaces.nsIResProtocolHandler);
var aliasFile = Components.classes["#mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
aliasFile.initWithPath("file:///C:/pics");
var aliasURI = Services.io.newFileURI(aliasFile);
resProt.setSubstitution("ExposedPics", aliasURI);
but the same thing happens, the image doesn't display. I did notice that if I put document.body.style.border = "5px solid red"; at the top of expose.js, I do see a border around the body, but if I move it to below the line Components.utils.import("resource://gre/modules/Services.jsm"); it doesn't show up. Therefore, I suspect the code to dynamically create a resource is broken.
What am I doing wrong? Ultimately, how can I get an image on the client's machine to show up on a page from the internet?
You are writing a WebExtensions so none of the APIs you are trying to use exist.
This includes Components.utils.import, Components.classes etc. You should read Working with files on MDN to get an idea, what is still possible.

Why I am getting blank page for Mapboxgl api on IOS?

Working on mapboxgl with ionic3, angular4 and cordova.
I have build .apk and .ipa files. I installed .apk file in my android device it works as expected (ie mapbox tiles, my icons (I have added some icons to custom some functionalities for eg. added an icon to switch the map style) and my markers are loaded successfully).
When I install the .ipa file in my Iphone my icons only loaded but mapbox tiles not getting loaded. Also the markers. I get blank white screen.
What is wrong with my implementation?
let data = {myJson data};
mapboxgl.accessToken = 'My access token';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v9',
attributionControl: false,
center: [-74.50, 40],
zoom: 12
});
map.on('load', function () {
map.addSource("place", {
type: "geojson",
data: data,
cluster: true,
clusterMaxZoom: 14, // Max zoom to cluster points on
clusterRadius: 50 // Radius of each cluster when clustering points (defaults to 50)
});
map.addLayer({
"id": "places",
"type": "circle",
"source": "place",
"paint": {
"circle-radius": 7,
"circle-color": "#32CD32",
"circle-stroke-width": 4,
"circle-stroke-color": "#FFFFFF"
}
});
});
Can you help with me with the code added here?
This code works fine in Android. I mean map is loading as expected. But in Iphone My app is working but Map is not loading. Any guess what is wrong?
please check in info.plist for key MGLMapboxAccessToken is set with proper token. this is very important to set this value.
If you don't have source code even thought you can check by extraction IPA. below are step to extract IPA.
Change extension from IPA to ZIP.
Extract zip file
In payload you will find app. right click on it and click on show package contents
Open info.plist and search for key and it's value.
I hope you will get your answer

Trying to send geoJSON file to iTunesConnect

I'm trying to upload the "Routing App Coverage File" to iTunesConnect. I get the message "Your file couldnt be saved, try again or contact us".
The file contents are below.. I've checked the contents on geojsonlint and they seem correct.
{ "type": "MultiPolygon",
"coordinates": [
[[ [-75.767212,39.702961],
[-76.25061,36.85545],
[-78.491821,38.030786],
[-78.200684,39.187562],
[-77.774963,39.626846],
[-75.767212,39.702961]
] ]]
}
Does the filename have to be special? Is there another problem?
This may help others. What solved this for me, was simply, that I had a couple of extra spaces, one at the beginning, and another at the end.

Unable to upload GeoJSON file to iTunes Connect

I'm getting the following error:
"The JSON file you uploaded was invalid. Errors : Each set of coordinates provided must be valid"
The Contents of the file are:
{ "type" : "MultiPolygon",
"coordinates": [
[[[19.5,-99.1], [19.5,-99.2], [19.3,-99.2], [19.2,-99.1], [19.2,-98.9], [19.3,-98.9], [19.5,-99.0]]]
]
}
I really can't find whats wrong, it works perfectly on the Simulator.
Any ideas ?
The order of Coordinate in GEOJSON is [longitude, latitude] :)
You can check more detail on: http://geojson.org/geojson-spec.html#appendix-a-geometry-examples
or validate your geoJSON on: http://geojsonlint.com
Hope it is helpful.
I copied swaped the order of the coordinates, as in the Apple Docs. And made the start and ending coordinates equal.

Resources