KML for XY Maps

Hi everyone, long time lurker on the forum, but first time poster.
Hopefully the awesome appsheet community and staff can help me with this one.

This question has a few parts, but I’ll start with the basic foundation first
Q1. Is it possible to use a KML layer for an XY map?
I would like to be able to designate different zones on the reference image being used for the XY map.

If it is possible, then let’s proceed to my next question
Q2. How can I generate my own custom KML files with freeform boundaries? Ideally, I could trace over the reference image, or select multiple points to create the boundary shape.

Q3. Is it possible to relate a pin drop to the KML information? For example, if I drop a pin to indicate some feature, is it possible to make it automatically detect which zone it is in (like what state for a geographic KML for example)? Specifically, for an inspected item, could I identify if it was a Structural or Non-structural area based on the KML data, and furthermore, could I assign other information to the KML zone too, like steel type and thickness? Or does this additional information need to be in separate KML layers?

Q4. Can the KML layers be toggled to show or not show? or specific KML layers selected?

It would unlock amazing capabilities in my apps if even some of this could work!

Thanks
Simon

Welcome to community first of all. let me address your query one by one.

Q1. Is it possible to use a KML layer for an XY map?

I think it is doable. You set the data field tye to xy type and place link your KLM file you placed on somewhere in the cloud.

Q2. How can I generate my own custom KML files with freeform boundaries? Ideally, I could trace over the reference image, or select multiple points to create the boundary shape.

Easiest tool to generate KLM flle is Google My Map. Ask Google you will find it easily.

Q3. Is it possible to relate a pin drop to the KML information?

yes, you can. I remember someone asked the similar question and I made advice. See the link to that post. Read this post first.

Q4. Can the KML layers be toggled to show or not show? or specific KML layers selected?

Yes, I think this is doable as well.

This is not direct solutions to your requiement, but I placed a quick sample app on my portfolio. This app will dynamically add and change the xy type layer.

https://www.appsheet.com/samples/Sample-App?appGuidString=3e079bf0-211e-4948-88bc-920f6af8d46d

3 Likes

Thanks Tsuji_koichi ! I’ve been following your work/posts and honestly I’m impressed by what you can figure out.

I’m a total novice at building apps - what I’m trying do is understand what the limitations/capabilities of Appsheet are so that I know what to ask other people (shout out to the QREW team) to build for me :wink:

So just to clarify, I am not using google maps and latlong at all. I just use images for XY maps. I guess the easiest way to explain this would be like a building floor plan, and doing a KML to show the various rooms. Specifically, what I am trying to do is take images of sections of a 3D Model of mining machinery and use these as XY maps so that I can record where defects are on that type of machine.

Re Q1 - I have been looking around on the forums and help and I can’t find where the KML file is referenced…do you know of a simple walkthrough? Or can you share a couple of screenshots showing where to get to that function in appsheet?

Re Q2 - Can I use google my maps to load a custom image to use to generate a KML for it? I tried it just then but couldn’t seen any option for using my own custom base image. Is there another solution like this?

Re Q3 - Using your example app as inspiration, would it be possible to click the pin for a KML region, to then pre-fill information relating to that KML area, then allow the user to drop a pin within the KML area using the pre-filled information and create an inspection record?

Thanks again
Simon

Oh you know QREW, yes, I got new friend, Stefan as well.

Answering your questions.

Q1 ; Set your data field type to either image or XY, then go to edit mode on that field.
You upload background image for xy and also klm file down there.

Q2 ; I dont think so. We probably need to find a tool to draw KLM files over the custom image. I will google it, but member in the community may have knowledge.

Q3 ; yes, I think it is also doable not perfectly in the way what you want, but similar experience. You create master table for definition and / or category for your AREA, then make a ref to your xy fields. This master table should have lat long cordinate to display over the image with pin.
Upon clicking pin on the map view (with xy type column), then the details view will pop up for the selected pin.

Thanks for the explanations.

Re the KML tools, I have found these options
https://openlayers.org/en/latest/examples/xyz.html - tile data source

https://openlayers.org/en/latest/examples/draw-features.html - polygon or hold shift for freehand drawing

https://openlayers.org/en/latest/examples/layer-z-index.html

https://openlayers.org/en/latest/examples/layer-group.html - layer selection and opacity

But this hardcore coding is well beyond my ability. Maybe someone else in the community can adapt this and figure it out though, as I think this would open up some super powerful possibilities for Appsheet. I’m envisaging a tool or website where you can upload your XY image, then mark-up the information on the image (boundaries, points, etc) and then download/save the KML relevant to that image.

Also, there is this, which might be able to be adapted?
https://www.doogal.co.uk/polylines.php

https://www.doogal.co.uk/js/siteBundle.min.js

Can not find the capability to user the custom image file as background image on this web tool.

I wait for anyone in the community to help you out, but I do have one workaround in mind. Not sure if it will work until I physically test it with those tools and Appsheet. Will try to find a time for this testing which may require a bit of time. And I need to leave now for holiday - skiing…

Just a bump to get this back into the recent list…hopefully someone out there may also be interested in trying to finding a solution. Or perhaps the Appsheet dev team?

Really curious as well

This colour picker by @Fabian could actually potentially be adapted

@Fabian can you share how you did the code for the XY mapping?

Hi @Simon_Krismer. The XY has a simple background image.

https://drive.google.com/uc?id=10QXpQ5JWO_My8iVfzrtiLI9XhA6EJ-hr

But honestly I can’t understand how this could solve your KML problem? :thinking:

Maybe there is coming something :slight_smile:

Think more so how to “plot” locations on an XY image. Which is exactly what your solution does.
Specifically, how did you identify each zone on the image so that it corresponded to a colour? The same concept should be be possible to apply in order to identify zones of any shape on an XY map, depending on the how fine a scale is used for the lat long.

Oh sorry yes of course, this would be a solution.
I’m using an expression:

SWITCH(ROUND(LAT([XY]))&ROUND(LONG([XY])),
4646,000000,
4746,434343,
4846,666666,
4946,999999,
5046,B7B7B7,
5146,CCCCCC,
5246,D9D9D9,
5346,EFEFEF,
5446,F3F3F3,
5546,FFFFFF,
... and so on ... ,
"")

So if you add a Pin to the XY Map, it may have a LatLong 51.657836, 45.976563 for example.
ROUND(LAT([XY]))&ROUND(LONG([XY])
would give me 5246 which in my case would be the HEX color D9D9D9.

So you would need to list all possible LatLong combinations.
You could use also a Lookup Table for that.
But man that would be a huge list!

And I think you would need an image of a map as the background image. Something like this.

You can not use a map column. Because the LatLong System of a map goes from 85 to -85 and from 180 to -180.
image
But the LatLong system of AppSheet’s XY column goes from 0 to 100, because these are Percent values.

1 Like

Ah, using the Switch function. I see.
Yeah, it would just need a 100x100 grid with each intersection identified regarding it’s location. Eg, for a floorplan the location would be identified by room such as Bedroom 1, Bathroom, Kitchen, etc.
It will take a lot of work to code up though - would be great if there was a more automated solution for identifying each point.

1 Like