ghettovoice / vuelayers

Web map Vue components with the power of OpenLayers
https://vuelayers.github.io/
MIT License
683 stars 229 forks source link

TopoJson is not rendered on map #426

Closed li-shasha closed 3 years ago

li-shasha commented 3 years ago

currently topojson data is not rendered on map even with component vl-source-vector :format-factory property and :overlap=false

wasser.json is a topology json data.

<vl-source-vector :url="/maps/wasser.json" :format-factory="createTopoJsonFmt" :overlaps="false"></vl-source-vector>

...

import {TopoJSON} from 'ol/format';
...
methods: {
  createTopoJsonFmt(){
    return new TopoJSON({})
  }
}

can you help to check it please? you can see the topojson with mapshapper or whatever you like. sandbox example

ghettovoice commented 3 years ago

Hi @li-shasha , the topojson file not work even with openlayers https://jsfiddle.net/ghettovoice/sdx98e2f/42/. If you check in the console created features, you will see that some of coordinates have Nan value. Usually this due to incorrect projection.

li-shasha commented 3 years ago

thank you very much! just as what you said, topojson rendered after i add dataProjection property.

li-shasha commented 3 years ago

vuelayers work with topojson. It just need proper data projection