0

i went through lots of answers posted regarding the below question. i wanted to retrieve the kml file from the local and so i used geoxml

var myParser = new geoXML3.parser({ map: map });

myParser.parse('indiastatev2.kml');

here is the code which i am trying to make work my file is stored here in this folder here

i am not able to get the file path to pass in here are the solution which i tried doing it in different ways

myParser.parse('~/Content/KmlData/indiastatev2.kml');
myParser.parse('../../Content/KmlData/indiastatev2.kml');

none of them is working

this is what i am getting each time error

here is my script this

i had already tried putting down the kml file in same folder but it didnt work

please suggest me something to make it work

Ronak Shetiya
  • 960
  • 6
  • 27
  • 1
    How can we help if we don't know where your script is in the folder structure? – MrUpsidown Feb 18 '19 at 11:14
  • @MrUpsidown my script is working well only the thing is m not able to get the path of the my file which i need to parse, already posted the pictures, still if u need you need to see my script placement i can edit the post – Ronak Shetiya Feb 18 '19 at 11:30
  • 1
    Obviously you need a *relative path* to your kml file. This depends on where the script which contains `myParser.parse('indiastatev2.kml')` is located. So yes, edit your question with at least a screenshot that shows where your JS file is located. – MrUpsidown Feb 18 '19 at 11:32
  • Have you tried putting the KML file in the same directory as the webpage/script? If you want it in a different directory, it needs to have a relative path to it from the location the page is loading from. Is your web server set up to serve KML files? – geocodezip Feb 18 '19 at 17:09
  • [Example loading KML file in same directory as loaded page](http://www.geocodezip.com/geoxml3_test/v3_geoxml3_KML_samples_test.html) (on a webserver) – geocodezip Feb 18 '19 at 17:16
  • 1
    @geocodezip where can i see the source code of above example ? – Ronak Shetiya Feb 19 '19 at 06:05
  • 1
    @MrUpsidown i have already showed u where my kml files are located – Ronak Shetiya Feb 19 '19 at 06:06
  • view-source on the page – geocodezip Feb 19 '19 at 07:10

0 Answers0