After watching a recent Google Devs video, I decided to make a UK regional map. Several opportunities were mentioned on this site that I have since had to dismiss *
So, I ended up using this site (example data download page): http://mapit.mysociety.org/area/11804.html
Pay attention to loading GeoJSON , how on the third connection down? Its file size is 1 MB. When I first tried using it with my card:
function initMap(){ var ukc = new google.maps.LatLng(54.8, -4.6); var mapOptions = { zoom: 5, center: ukc }; map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); map.data.loadGeoJson('http://local.mapsite.com:8080/app/jsondata/eastern.json'); } $(document).ready(function(){ initMap(); });
I got the above error: Uncaught InvalidValueError: not Feature or FeatureCollection
Fix Attempt 1 - Google it
Error starting error returned with nothing useful.
Fix Try 2 - Squeeze It
I thought it was the sheer size of the beast, so I reduced it with mapshaper.org to a more manageable 10K. Not lucky yet!
Fix Attempt 3 - Lint it
Maybe my GeoJSON was poorly formatted? But as you might think this worked correctly on mapit.org, but I found this wonderful GeoJSON data overlay site: http://geojsonlint.com/ - Worked! Obviously, GeoJSON worked so well that it drew my East Angle polygon to the UK in all its glory (note geojsonlint uses OpenStreetMap). But still inaction
Bug Fix 4 - TopoJson
Hoping that I could unite the regions and squeeze at the same time, I desperately thought that topyson would work. I tried - I still have the same error. Here's a link to my topojson file that was opened on Google Drive: someregions.json No luck .
Fix Attempt 5 - Add Function Code to Run JSON
The current GeoJSON file {"BBOX" is launched: [- 0.745702,51.448473,1.767999,52.98991], "Type": "GeometryCollection", "geometry": ...
I added:
{"type": "Feature", "bbox":[-0.745702,51.448473,1.767999,52.98991],"type":"GeometryCollection","geometries":
Fix Attempt 6
Repeat several areas because they do not contain the bbox parameter next to the launch, but simply start {"type": "Polygon", "coordinates": [[[-3.155785, 53.427385], [-3.151533, 53.427328], [...
Still no luck .
The (Failed) Conclusion
Even though I proved that my file was small enough, groped, and worked elsewhere, I still received these error messages from the console when I tried to place them on my card.
Uncaught InvalidValueError: not a Feature or FeatureCollection
Here is my compressed GeoJSON file, shared through GDrive: https://drive.google.com/file/d/0B42Aec8RKcHtNVNZZUxqV0Y5Rkk/edit?usp=sharing
My subsequent attempts will include topojson to squeeze all regions into one with inner borders, but I wanted to check here first to see if anyone knows what my problem might be? Because it could be a few more hours of wasted energy wasted.
* An attempt to use the data from the crawl surveys failed because they provided SHD and not SHP data as indicated in the previous question on this issue. Therefore, I could not convert it to GeoJSON using ogr2ogr.