Modify

Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#5451 closed enhancement (fixed)

PicLayer calibration - GE .kml file support

Reported by: jp42@… Owned by: Larry0ua
Priority: normal Milestone:
Component: Plugin piclayer Version: latest
Keywords: Cc:

Description (last modified by Larry0ua)

I have many images held in KML format as overlays. It would be helpful to store the PicLayer calibration information in a KML file. That would mean I could cut and paste KML data into the calibration file and the calibration would be ready to go. Likewise something calibrated in JOSM could be looked at in Google Earth.

See the two example files attached. They are the KML for and the cal file for, the same image (not supplied). They place the image in roughly the same location in GE and JOSM.

Attachments (3)

piclayer-proj.png (171.7 KB ) - added by bastiK 12 years ago.
allee-sued-ba4-2_crop.kml (591 bytes ) - added by thrap 12 years ago.
kml-file for Nidderau Bauabschnitt 4
allee-sued-ba4-2_crop.jpg (1.5 MB ) - added by thrap 12 years ago.
jpg-file for Nidderau Bauabschnitt 4

Download all attachments as: .zip

Change History (20)

comment:1 by jp42@…, 14 years ago

TRAC says my files are SPAM, so sorry I could not upload them. Here they are: cal then kml

//-------------------------------------------------------------

#JOSM PicLayer plug-in calibration data
#Tue Sep 14 07:40:10 EST 2010
SCALEY=0.3479999999999994
INITIAL_SCALE=1164.9675295686193
SCALEX=0.4359999999999995
POSITION_Y=-37.82686094290884
POSITION_X=144.92064425132614
INITIAL_POS_y=-37.81863140486528
INITIAL_POS_X=144.9641153063133
ANGLE=1.2999999999999985

//-------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">

<GroundOverlay>
		<name>test_calibration</name>
		<visibility>1</visibility>
		<Icon>
			<href>test_calibration_image.png</href>
			<viewBoundScale>0.75</viewBoundScale>
		</Icon>
		<LatLonBox>
			<north>-37.76505587109686</north>
			<south>-37.88913530429822</south>
			<east>144.9867723342221</east>
			<west>144.8548541106736</west>
			<rotation>-1.326887403123449</rotation>
		</LatLonBox>
	</GroundOverlay>
</kml>

Last edited 12 years ago by bastiK (previous) (diff)

comment:2 by stoecker, 14 years ago

Solving the captcha and logging in would have helped for you file. Or you can add it as zip archive.

comment:3 by Larry0ua, 12 years ago

Description: modified (diff)
Owner: changed from team to Larry0ua
Status: newassigned
Summary: Calibration file as kml to allow calibration by cut and pastePicLayer calibration - GE .kml file support

comment:4 by bastiK, 12 years ago

@Larry0ua:

I understand the reference like this:

  • first move the image into the given bounding box
  • then rotate counterclockwise by the given angle about the center of the image

Could be done by the following algorithm:

  • convert lat/lon box to east/north box [x1,y1,x2,y2]
  • build affine transformation:
    • scale by ((x2-x1)/w, (y2-y1)/h)
      (w - image width in px, h - image height)
    • rotate
    • move by east/north value of center point (x1+(x2-x1)/2, y1+(y2-y1)/2)

As a first step, there should be a movement by (-w/2, -h/2), but I think this is already implied in the piclayer algorithm:

 g.drawImage( image, -image.getWidth(null) / 2, -image.getHeight(null) / 2, null );

comment:5 by Larry0ua, 12 years ago

Resolution: fixed
Status: assignedclosed

Now KML is supported for PicLayer and ready for testing. Please post any unsupported or badly calibrated KMLs here. [o27231]

In supported I mean:
[+] opening KML with LatLonBox is OK
[+] multiimage KML is supported
[-] saving is not implemented (I see gx:LatLonQuad as something to work on, but may be later - have no idea about how to read such because that is not affine in general - I can convert to, but cannot convert from).

by bastiK, 12 years ago

Attachment: piclayer-proj.png added

comment:6 by bastiK, 12 years ago

There are problems with large images in projections other than Mercator and WGS84.


I noticed, that google earth would really reproject the image (to fit the red quadrilateral) and even make the upper and lower edges curved (to follow the line of constant latitude).

We should seriously look for a library that can do more than affine transformation. One candidate would be GeoTools.

comment:7 by bastiK, 12 years ago

There is a typo in the reader: "rotate" should be "rotation"

comment:8 by bastiK, 12 years ago

Whish: support for kmz files.

comment:9 by Larry0ua, 12 years ago

rotation - fixed.
kmz - hope to have it in the future, as using it too, and it does not look harder than kml (just zip with kml and images inside)
about reporjection... really not easy stuff, needs investigation

comment:11 by stoecker, 12 years ago

Ooops Zip, then see trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java, which also supports Zip-File including images.

Last edited 12 years ago by stoecker (previous) (diff)

comment:12 by Larry0ua, 12 years ago

@stoecker, actually there is support of zip in PicLayer so it will be not a problem :)

comment:13 by stoecker, 12 years ago

Zip itself is no problem, true. But the core has already a "get the image for me and don't bother me with the real place" functionality including zip support.

comment:14 by baditaflorin, 12 years ago

If i could load kml or kmz with picture inside it would be perfect :)

And dynamic kml like these

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://www.opengis.net/kml/2.2">
  <NetworkLink>
    <open>1</open>
    <name>Demographics/ESRI_Population_World</name>
    <LookAt>
      <longitude>-1.47523492544022</longitude>
      <latitude>11.8018794035218</latitude>
      <range>28241154.7596751</range>
    </LookAt>
    <Region>
      <LatLonAltBox>
        <north>90</north>
        <south>-90</south>
        <east>180</east>
        <west>-180</west>
      </LatLonAltBox>
      <Lod>
        <minLodPixels>128</minLodPixels>
        <maxLodPixels>-1</maxLodPixels>
      </Lod>
    </Region>
    <Url>
      <viewRefreshMode>onStop</viewRefreshMode>
      <viewRefreshTime>2</viewRefreshTime>
      <href>http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer/export</href>
      <viewFormat>f=kmz&amp;bboxSR=4326&amp;imageSR=4326&amp;transparent=true&amp;bbox=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]&amp;size=[horizPixels],[vertPixels]&amp;</viewFormat>
    </Url>
  </NetworkLink>
</kml>  
Last edited 12 years ago by bastiK (previous) (diff)

by thrap, 12 years ago

Attachment: allee-sued-ba4-2_crop.kml added

kml-file for Nidderau Bauabschnitt 4

by thrap, 12 years ago

Attachment: allee-sued-ba4-2_crop.jpg added

jpg-file for Nidderau Bauabschnitt 4

comment:15 by thrap, 12 years ago

regarding Nidderau Bauabschnitt 4 / allee-sued-ba4-2_crop:

I received a map from city government for a new residential aerea in our city. In Google Earth I put in in the right place and dimension. From the kmz-file I extracted the kml and changed the path (cancel "/file/").

In JOSM using piclayer the import worked but the map was shown bigger than it should be, I would say 3 times.

I's a pitty that this useful function doesn't work.

Thomas

in reply to:  15 comment:16 by thrap, 12 years ago

Replying to thrap:

regarding Nidderau Bauabschnitt 4 / allee-sued-ba4-2_crop:

I received a map from city government for a new residential aerea in our city. In Google Earth I put in in the right place and dimension. From the kmz-file I extracted the kml and changed the path (cancel "/file/").

In JOSM using piclayer the import worked but the map was shown bigger than it should be, I would say 3 times.

I's a pitty that this useful function doesn't work.

Thomas

I found out the right way to change the dimension of the map. Everything fine! wonderful tool.
Thomas

comment:17 by Larry0ua, 12 years ago

May you share your information or/and kmz?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Larry0ua.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.