none
Bing Map V8, D3.js and TopoJson RRS feed

  • Question

  • Does anyone know how to overlay a topojson file over Bing Map?  The sample shown in here  doesn't work in Bing Map v8 and some functions are missing (e.g., getRootElement(), etc.).

    I also tried using geojson files but I can't get Bing Map to read my geojson files, either.  Not sure if projection has anything to do with it since my data are in Albers projection.

    Appreciate any help.


    Marilyn Gambone

    Thursday, March 28, 2019 12:45 PM

Answers

  • Your GeoJSON file appears to be in some other coordinate system. While GeoJSON doesn't explicitly specify a coordinate system, most example use WGS84 Lat/Long coordinates. If you are seeing very large values like you posted, it's probably in some other coordinate system like UTM. You'll need to translate it to EPSG 3857 before you can properly overly it on Bing maps.
    • Marked as answer by deskcheck1 Saturday, March 30, 2019 10:23 AM
    Thursday, March 28, 2019 9:14 PM
    Moderator

All replies

  • Hi Marilyn,

    The sample you point to is from 2011 so that would be the older control.  Can you review the sample code at https://www.bing.com/api/maps/sdk/mapcontrol/isdk/geojsonreadexternal and see if it works for your scenario?  (See the menu on the right for more data related samples)

    Sincerely,

    IoTGirl


    Thursday, March 28, 2019 4:41 PM
    Owner
  • Hi,

    I previously reviewed the samples in this website.  What I noticed was the format for coordinates of the geojson files show small decimal numbers.  For example, [23.594043, -33.794474] whereas mine has large decimal numbers, like
    [ 1721085.0000000023, 2054654.9999999993 ].  I used this online tool to get my coordinates.

    So, I think that's why none of the examples in the website works with my data.


    Marilyn Gambone

    Thursday, March 28, 2019 7:44 PM
  • Your GeoJSON file appears to be in some other coordinate system. While GeoJSON doesn't explicitly specify a coordinate system, most example use WGS84 Lat/Long coordinates. If you are seeing very large values like you posted, it's probably in some other coordinate system like UTM. You'll need to translate it to EPSG 3857 before you can properly overly it on Bing maps.
    • Marked as answer by deskcheck1 Saturday, March 30, 2019 10:23 AM
    Thursday, March 28, 2019 9:14 PM
    Moderator
  • Hi,

    Thanks.  I realized using Mapshaper somehow uses those big numbers.  Even though I've reprojected them to EPSG 3857, as soon as I convert my shapefiles into geojson using Mapshaper, it's back to the big decimals.  So I had to actually add the Latitude and Longitude to my shapefiles first using ArcGIS and then convert them into geojson.  That way, I could pull the lat/longs using the json properties.

    Mapshaper is really good in converting shapefiles to json.  I just wish they show the coordinates as EPSG 3857.

    Thanks, again, for the help.


    Marilyn Gambone

    Saturday, March 30, 2019 10:27 AM