rcb007 Posted September 21, 2020 Share Posted September 21, 2020 I am trying to send coordinates from CAD into a web link address. Everything works except its having a hard time with spaces. My example I am wanting to match is the following: http://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?aoicoords=((-98.20956 46.44914,-98.1925 46.44903,-98.19231 46.46183,-98.20937 46.46195,-98.20956 46.44914)) The code I have written: (setq Website (strcat "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?aoicoords=((" LONG " " LAT "," LONG2 " " LAT2 "," LONG3 " " LAT3 "," LONG4 " " LAT4 "," LONG " " LAT "")) The internet explorer web link: (%20) http://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?aoicoords=((-98.20956%2046.44914,-98.1925%2046.44903,-98.19231%2046.46183,-98.20937%2046.46195,-98.20956%2046.44914)) Is there a way I can replace the %20 to a space? The example address works with spaces. I guess I am missing something. Thank you. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 21, 2020 Share Posted September 21, 2020 Maybe this. [ UNTESTED ] (setq url "http://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?aoicoords=((-98.20956%2046.44914,-98.1925%2046.44903,-98.19231%2046.46183,-98.20937%2046.46195,-98.20956%2046.44914))") (while (vl-string-search "%20" url) (setq url (vl-string-subst " " "%20" url)) ) Quote Link to comment Share on other sites More sharing options...
rcb007 Posted September 21, 2020 Author Share Posted September 21, 2020 Interesting, I ran the code, and it removes it from the setq url. Is there any I can send that link to a web browser after its cleaned up? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 21, 2020 Share Posted September 21, 2020 Also maybe. (startapp "explorer" url) Quote Link to comment Share on other sites More sharing options...
rcb007 Posted September 21, 2020 Author Share Posted September 21, 2020 Ok I did some digging around. I found this which works and gives a 33. Command: (startapp "explorer" "https://autolispprograms.wordpress.com") 33 Command: (startapp "explorer" "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?aoicoords=((-98.20956%2046.44914,-98.1925%2046.44903,-98.19231%2046.46183,-98.20937%2046.46195,-98.20956%2046.44914))") 33 The bottom one, I put the direct link like the above. however, it wants to open my file explorer. (startapp "explorer" "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?aoicoords=((-98.20956 46.44914,-98.1925 46.44903,-98.19231 46.46183,-98.20937 46.46195,-98.20956 46.44914))") I tried removing the (%20) and it still wants to open just the file explorer. Any idea what would be causing this? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 21, 2020 Share Posted September 21, 2020 What do you mean by it wants to open the file explorer ? don't you mean the browser ? let it go so what happens after all ? I am not sure if your path is correct or if it is possible to load the coordinates to that website the way you are doing it. Quote Link to comment Share on other sites More sharing options...
rcb007 Posted September 21, 2020 Author Share Posted September 21, 2020 Within my pc, when I run this Command: (startapp "explorer" https://autolispprograms.wordpress.com) = It opens internet explorer and goes to that web address. When I run Command: (startapp "explorer" https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?aoicoords=((-98.20956 46.44914,-98.1925 46.44903,-98.19231 46.46183,-98.20937 46.46195,-98.20956 46.44914))) = It opens My Documents Folder. That's a bummer if its not possible. I am using there example from the web site. https://www.nrcs.usda.gov/wps/portal/nrcs/detail/soils/survey/?cid=stelprdb1240085 aoicoords The aoicoords query parameter specifies an AOI as a polygon. Each pair of coordinates consists of a longitude and a latitude. The list of coordinates specifies a single POLYGON in the Well-Known Text offsite link image format. For example, http://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?aoicoords=((-98.20956 46.44914,-98.1925 46.44903,-98.19231 46.46183,-98.20937 46.46195,-98.20956 46.44914)) sets your AOI to the specified polygon. If your AOI is already set to the specified polygon, the application recognizes this and does not re-set your AOI. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 21, 2020 Share Posted September 21, 2020 Is this what the outcome should look like? Quote Link to comment Share on other sites More sharing options...
rcb007 Posted September 21, 2020 Author Share Posted September 21, 2020 I hate to ask this, but is anyone familiar with the (WKT) or Well Known Text Markup? https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry Quote "Well-known text" redirects here. For representation of coordinate reference systems, see Well-known text representation of coordinate reference systems. Well-known text (WKT) is a text markup language for representing vector geometry objects. A binary equivalent, known as well-known binary (WKB), is used to transfer and store the same information in a more compact form convenient for computer processing but that is not human-readable. The formats were originally defined by the Open Geospatial Consortium (OGC) and described in their Simple Feature Access.[1] The current standard definition is in the ISO/IEC 13249-3:2016 standard.[2] Can lisp be written into this type of format? Quote Link to comment Share on other sites More sharing options...
rcb007 Posted September 21, 2020 Author Share Posted September 21, 2020 Yup! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.